Issue
I want to multi line text on a button
but multi lining make it little bit shift down
How to fix it?
Here is XML code of Button
:-
<TableLayout
android:id="@+id/tab_buttons"
android:layout_width="368dp"
android:layout_alignParentTop="true"
android:layout_height="wrap_content"
tools:layout_editor_absoluteY="0dp"
tools:layout_editor_absoluteX="8dp">
<TableRow>
<Button
android:id="@+id/clock"
android:background="#BAFFBA"
android:text="@string/clock" />
<Button
android:id="@+id/Alarm"
android:text="@string/Alarm"
android:background="#004819"
android:textColor="#FFFFFF"
/>
<Button
android:id="@+id/stopwatch"
android:background="#BAFFBA"
android:text="@string/Stopwatch" />
<Button
android:id="@+id/timer"
android:background="#BAFFBA"
android:text="@string/Timer" />
</TableRow>
</TableLayout>
Here is string
stopwatch:-
<string name="Stopwatch">Stop Watch</string>
Solution
<TableLayout android:id="@+id/tab_buttons"
android:layout_width="368dp"
android:layout_alignParentTop="true"
android:layout_height="wrap_content"
tools:layout_editor_absoluteY="0dp"
tools:layout_editor_absoluteX="8dp"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<TableRow>
<Button
android:id="@+id/clock"
android:background="#BAFFBA"
android:text="CLOCK" />
<Button
android:id="@+id/Alarm"
android:text="ALARM"
android:background="#004819"
android:textColor="#FFFFFF"
/>
<Button
android:id="@+id/stopwatch"
android:background="#BAFFBA"
android:layout_height="match_parent"
android:text="Stop Watch" />
<Button
android:id="@+id/timer"
android:background="#BAFFBA"
android:text="TIMER" />
</TableRow>
</TableLayout>
Just apply android:layout_height="match_parent"
to stopwatch Button.
Answered By - rahul shah
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.