Here is the layout when each Button
has the same size text:
And here is the layout when I increase the size of the bottom right Button
's text:
What's going on here? Why is the "0" Button
moving lower than the two Buttons
adjacent to it?
Here is the layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@android:color/white"
android:orientation="vertical"
android:padding="6dp">
<TextView
android:id="@+id/input_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColorHint="@color/hint_color"
android:singleLine="true"
android:textSize="40sp"/>
<GridLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:columnCount="3">
<Button
android:id="@+id/the_1_button"
android:background="@android:color/white"
android:text="1"/>
<Button
android:id="@+id/the_2_button"
android:background="@android:color/white"
android:text="2"/>
<Button
android:id="@+id/the_3_button"
android:background="@android:color/white"
android:text="3"/>
<Button
android:id="@+id/the_4_button"
android:background="@android:color/white"
android:text="4"/>
<Button
android:id="@+id/the_5_button"
android:background="@android:color/white"
android:text="5"/>
<Button
android:id="@+id/the_6_button"
android:background="@android:color/white"
android:text="6"/>
<Button
android:id="@+id/the_7_button"
android:background="@android:color/white"
android:text="7"/>
<Button
android:id="@+id/the_8_button"
android:background="@android:color/white"
android:text="8"/>
<Button
android:id="@+id/the_9_button"
android:background="@android:color/white"
android:text="9"/>
<ImageButton
android:id="@+id/the_backspace_button"
style="@style/Widget.AppCompat.Button"
android:background="@android:color/white"
android:src="@drawable/ic_backspace"/>
<Button
android:id="@+id/the_0_button"
android:background="@android:color/white"
android:text="0"/>
<Button
android:id="@+id/the_done_button"
android:layout_width="88dp"
android:layout_height="48dp"
android:minWidth="0dp"
android:minHeight="0dp"
android:background="@android:color/white"
android:text="done"/>
</GridLayout>
</LinearLayout>
Update:
I made the text of the "DONE" Button
super large -- 100sp -- and set maxWidth
and maxHeight
for it equal to the height and width of the other Buttons
. Here is the result:
*the blue is the GridLayout
's background, the red the "0" Button's
, and the yellow the "DONE" Button's
Why would changing the size of the text of the "DONE" Button affect anything other than that specific Button
if the size of the Button
never changes?