Align anchored widgets to fill whitespace in Android Studio - android-studio

I am new at Android development and I am struggling with the following.
I am building a simple calculator application with a 4x4 keypad.
All the buttons are anchored from right to left and bottom to top. Baselines are used as well.
The top-left button will be anchored to the TextView above.
I need the buttons to keep the square size I gave them, but also be aligned properly so they fill the white space remaining to the right.
I tried anchoring the right side of the right-edge button to the right side of the TextView, but the intermediate column spacing is not divided in equal portions.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<EditText
android:id="#+id/txtResult"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:ems="10"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center"
android:inputType="numberSigned|number|numberDecimal"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="#+id/txtNewNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:ems="10"
android:focusable="false"
android:focusableInTouchMode="false"
android:inputType="numberSigned|numberDecimal"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/txtResult" />
<Button
android:id="#+id/btn1"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="16dp"
android:text="1"
android:textSize="24sp"
app:layout_constraintStart_toStartOf="#+id/txtNewNumber"
app:layout_constraintTop_toBottomOf="#+id/txtNewNumber" />
<Button
android:id="#+id/btn2"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="2"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn1"
app:layout_constraintStart_toEndOf="#+id/btn1" />
<Button
android:id="#+id/btn3"
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="3"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn2"
app:layout_constraintStart_toEndOf="#+id/btn2" />
<Button
android:id="#+id/btn4"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="8dp"
android:text="4"
android:textSize="24sp"
app:layout_constraintStart_toStartOf="#+id/btn1"
app:layout_constraintTop_toBottomOf="#+id/btn1" />
<Button
android:id="#+id/btn5"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="5"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn4"
app:layout_constraintStart_toEndOf="#+id/btn4" />
<Button
android:id="#+id/btn6"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="6"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn5"
app:layout_constraintStart_toEndOf="#+id/btn5" />
<Button
android:id="#+id/btn7"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="8"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn8"
app:layout_constraintStart_toEndOf="#+id/btn8" />
<Button
android:id="#+id/btn8"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="8dp"
android:text="7"
android:textSize="24sp"
app:layout_constraintStart_toStartOf="#+id/btn4"
app:layout_constraintTop_toBottomOf="#+id/btn4" />
<Button
android:id="#+id/btn9"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="9"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn7"
app:layout_constraintStart_toEndOf="#+id/btn7" />
<Button
android:id="#+id/btnPlus"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="+"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn3"
app:layout_constraintStart_toEndOf="#+id/btn3" />
<Button
android:id="#+id/btnMinus"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="-"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn6"
app:layout_constraintStart_toEndOf="#+id/btn6" />
<Button
android:id="#+id/btnMultiply"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="*"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn9"
app:layout_constraintStart_toEndOf="#+id/btn9" />
<Button
android:id="#+id/btnDot"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="8dp"
android:text="."
android:textSize="24sp"
app:layout_constraintStart_toStartOf="#+id/btn8"
app:layout_constraintTop_toBottomOf="#+id/btn8" />
<Button
android:id="#+id/btn0"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="0"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btnDot"
app:layout_constraintStart_toEndOf="#+id/btnDot" />
<Button
android:id="#+id/btnEquals"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="="
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn0"
app:layout_constraintStart_toEndOf="#+id/btn0" />
<Button
android:id="#+id/btnDivision"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="/"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btnEquals"
app:layout_constraintStart_toEndOf="#+id/btnEquals" />
</androidx.constraintlayout.widget.ConstraintLayout>

To spread out the buttons like you want, you can use ConstraintLayout CHAIN_SPREAD_INSIDE chains.
Here is your XML with the first row placed into a horizontal chain. See how the views spread out between the leftmost and rightmost anchor points? (I have set the rightmost anchor to the end of the result view.)
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="#+id/txtResult"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:ems="10"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center"
android:inputType="numberSigned|number|numberDecimal"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="#+id/txtNewNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:ems="10"
android:focusable="false"
android:focusableInTouchMode="false"
android:inputType="numberSigned|numberDecimal"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/txtResult" />
<Button
android:id="#+id/btn1"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="16dp"
android:text="1"
android:textSize="24sp"
app:layout_constraintEnd_toStartOf="#id/btn2"
app:layout_constraintStart_toStartOf="#+id/txtNewNumber"
app:layout_constraintTop_toBottomOf="#+id/txtNewNumber"
app:layout_constraintHorizontal_chainStyle="spread_inside" />
<Button
android:id="#+id/btn2"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="2"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn1"
app:layout_constraintEnd_toStartOf="#id/btn3"
app:layout_constraintStart_toEndOf="#+id/btn1" />
<Button
android:id="#+id/btn3"
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="3"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn2"
app:layout_constraintEnd_toStartOf="#id/btnPlus"
app:layout_constraintStart_toEndOf="#+id/btn2" />
<Button
android:id="#+id/btnPlus"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="+"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn3"
app:layout_constraintEnd_toEndOf="#id/txtResult"
app:layout_constraintStart_toEndOf="#+id/btn3" />
<Button
android:id="#+id/btn4"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="8dp"
android:text="4"
android:textSize="24sp"
app:layout_constraintStart_toStartOf="#+id/btn1"
app:layout_constraintTop_toBottomOf="#+id/btn1" />
<Button
android:id="#+id/btn5"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="5"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn4"
app:layout_constraintStart_toEndOf="#+id/btn4" />
<Button
android:id="#+id/btn6"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="6"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn5"
app:layout_constraintStart_toEndOf="#+id/btn5" />
<Button
android:id="#+id/btn7"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="8"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn8"
app:layout_constraintStart_toEndOf="#+id/btn8" />
<Button
android:id="#+id/btn8"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="8dp"
android:text="7"
android:textSize="24sp"
app:layout_constraintStart_toStartOf="#+id/btn4"
app:layout_constraintTop_toBottomOf="#+id/btn4" />
<Button
android:id="#+id/btn9"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="9"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn7"
app:layout_constraintStart_toEndOf="#+id/btn7" />
<Button
android:id="#+id/btnMinus"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="-"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn6"
app:layout_constraintStart_toEndOf="#+id/btn6" />
<Button
android:id="#+id/btnMultiply"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="*"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn9"
app:layout_constraintStart_toEndOf="#+id/btn9" />
<Button
android:id="#+id/btnDot"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="8dp"
android:text="."
android:textSize="24sp"
app:layout_constraintStart_toStartOf="#+id/btn8"
app:layout_constraintTop_toBottomOf="#+id/btn8" />
<Button
android:id="#+id/btn0"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="0"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btnDot"
app:layout_constraintStart_toEndOf="#+id/btnDot" />
<Button
android:id="#+id/btnEquals"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="="
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btn0"
app:layout_constraintStart_toEndOf="#+id/btn0" />
<Button
android:id="#+id/btnDivision"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:text="/"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="#+id/btnEquals"
app:layout_constraintStart_toEndOf="#+id/btnEquals" />
</androidx.constraintlayout.widget.ConstraintLayout>
The other rows will work the same way.

Related

My last of column of gridlayout going out of screen

I created gridlayout of 3 columns and it's doing great with large screen phone but with small screen phone there is problem last column going out of screen.
I also tried to set column_weight="1" but it's even worse.
Please help me I stuck here for many of days and tried so many things but it doesn't help.
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alignmentMode="alignMargins"
android:columnCount="3"
android:rowCount="8">
<TextView
android:layout_row="0"
android:layout_column="0"
android:padding="10dp"
android:text="#string/sub"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:layout_row="0"
android:layout_column="1"
android:layout_marginStart="50dp"
android:padding="10dp"
android:text="#string/credit"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:layout_row="0"
android:layout_column="2"
android:layout_marginStart="50dp"
android:padding="10dp"
android:text="#string/grade"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:layout_row="1"
android:layout_column="0"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:text="#string/m2"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_row="2"
android:layout_column="0"
android:layout_marginStart="10dp"
android:padding="10dp"
android:text="#string/dsa"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_row="3"
android:layout_column="0"
android:layout_marginStart="10dp"
android:padding="10dp"
android:text="#string/dsalab"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_row="4"
android:layout_column="0"
android:layout_marginStart="10dp"
android:padding="10dp"
android:text="#string/vee"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_row="5"
android:layout_column="0"
android:layout_marginStart="10dp"
android:padding="10dp"
android:text="#string/eeb"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_row="6"
android:layout_column="0"
android:layout_marginStart="10dp"
android:padding="10dp"
android:text="#string/dms"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_row="7"
android:layout_column="0"
android:layout_marginStart="10dp"
android:padding="10dp"
android:text="#string/anel"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_row="1"
android:layout_column="1"
android:layout_marginStart="70dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:text="4"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_row="2"
android:layout_column="1"
android:layout_marginStart="70dp"
android:padding="10dp"
android:text="3"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_row="3"
android:layout_column="1"
android:layout_marginStart="70dp"
android:padding="10dp"
android:text="1"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_row="4"
android:layout_column="1"
android:layout_marginStart="70dp"
android:padding="10dp"
android:text="3"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_row="5"
android:layout_column="1"
android:layout_marginStart="70dp"
android:padding="10dp"
android:text="3"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_row="6"
android:layout_column="1"
android:layout_marginStart="70dp"
android:padding="10dp"
android:text="3"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_row="7"
android:layout_column="1"
android:layout_marginStart="70dp"
android:padding="10dp"
android:text="3"
android:textColor="#4C4C4C"
android:textSize="24sp"
android:textStyle="bold" />
<EditText
android:layout_row="1"
android:layout_column="2"
android:layout_width="60dp"
android:background="#drawable/round_box"
android:layout_marginStart="63dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:inputType="text"
android:textColor="#color/colorPrimary"
android:textSize="24sp"
android:textStyle="bold" />
<EditText
android:layout_row="2"
android:layout_column="2"
android:layout_width="60dp"
android:background="#drawable/round_box"
android:layout_marginStart="63dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:inputType="text"
android:textColor="#color/colorPrimary"
android:textSize="24sp"
android:textStyle="bold" />
<EditText
android:layout_row="3"
android:layout_column="2"
android:layout_width="60dp"
android:background="#drawable/round_box"
android:layout_marginStart="63dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:inputType="text"
android:textColor="#color/colorPrimary"
android:textSize="24sp"
android:textStyle="bold" />
<EditText
android:layout_row="4"
android:layout_column="2"
android:layout_width="60dp"
android:background="#drawable/round_box"
android:layout_marginStart="63dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:inputType="text"
android:textColor="#color/colorPrimary"
android:textSize="24sp"
android:textStyle="bold" />
<EditText
android:layout_row="5"
android:layout_column="2"
android:layout_width="60dp"
android:background="#drawable/round_box"
android:layout_marginStart="63dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:inputType="text"
android:textColor="#color/colorPrimary"
android:textSize="24sp"
android:textStyle="bold" />
<EditText
android:layout_row="6"
android:layout_column="2"
android:layout_width="60dp"
android:background="#drawable/round_box"
android:layout_marginStart="63dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:inputType="text"
android:textColor="#color/colorPrimary"
android:textSize="24sp"
android:textStyle="bold" />
<EditText
android:layout_row="7"
android:layout_column="2"
android:layout_width="60dp"
android:background="#drawable/round_box"
android:layout_marginStart="63dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:inputType="text"
android:textColor="#color/colorPrimary"
android:textSize="24sp"
android:textStyle="bold" />
</GridLayout>

Buttons won't fill the whole space

I want my layout to display 6 buttons that fill the whole screen equally but at the moment each button fills just its padding.
Those 6 buttons are displayed inside a ConstraintLayout that is inside a ScrollView in order to display the layout well on any device.
This is my layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
tools:context=".MainActivity" >
<android.support.constraint.ConstraintLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/idbutton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON1"
app:layout_constraintBottom_toTopOf="#+id/idbutton3"
app:layout_constraintEnd_toStartOf="#+id/idbutton2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="#f0eb79"
android:foreground="?attr/selectableItemBackground"
android:drawableTop="#drawable/default_icon"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
android:padding="25dp" />
<Button
android:id="#+id/idbutton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON2"
app:layout_constraintBottom_toTopOf="#+id/idbutton4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/idbutton1"
app:layout_constraintTop_toTopOf="parent"
android:background="#000"
android:foreground="?attr/selectableItemBackground"
android:drawableTop="#drawable/default_icon"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
android:padding="25dp" />
<Button
android:id="#+id/idbutton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON3"
app:layout_constraintEnd_toStartOf="#+id/idbutton4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/idbutton1"
app:layout_constraintBottom_toTopOf="#+id/idbutton5"
android:background="#f0eb79"
android:foreground="?attr/selectableItemBackground"
android:drawableTop="#drawable/default_icon"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
android:padding="25dp" />
<Button
android:id="#+id/idbutton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON4"
app:layout_constraintBottom_toTopOf="#+id/idAppointments"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/idbutton3"
app:layout_constraintTop_toBottomOf="#+id/idbutton2"
android:background="#000"
android:foreground="?attr/selectableItemBackground"
android:drawableTop="#drawable/default_icon"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
android:padding="25dp" />
<Button
android:id="#+id/idbutton5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON5"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/idAppointments"
app:layout_constraintTop_toBottomOf="#+id/idbutton3"
app:layout_constraintStart_toStartOf="parent"
android:background="#f0eb79"
android:foreground="?attr/selectableItemBackground"
android:drawableTop="#drawable/default_icon"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
android:padding="25dp" />
<Button
android:id="#+id/idAppointments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/idbutton5"
app:layout_constraintTop_toBottomOf="#+id/idbutton4"
android:background="#000"
android:foreground="?attr/selectableItemBackground"
android:drawableTop="#drawable/default_icon"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
android:padding="25dp" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
This is the result I'm getting with the above code:
https://i.imgur.com/7mH0sZy.png
As you can see around the buttons there is the space that I don't want. Is there any way to make the buttons fill the whole space?
Try to use the code below (in this sample i removed android:drawableTop="#drawable/default_icon" but just add it again).
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/scrollView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
tools:context=".MainActivity"
>
<android.support.constraint.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/idbutton1"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#f0eb79"
android:foreground="?attr/selectableItemBackground"
android:padding="25dp"
android:text="BUTTON1"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="#+id/idbutton3"
app:layout_constraintEnd_toStartOf="#+id/idbutton2"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/idbutton2"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#000"
android:foreground="?attr/selectableItemBackground"
android:padding="25dp"
android:text="BUTTON2"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="#+id/idbutton4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/idbutton1"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/idbutton3"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#f0eb79"
android:foreground="?attr/selectableItemBackground"
android:padding="25dp"
android:text="BUTTON3"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="#+id/idbutton5"
app:layout_constraintEnd_toStartOf="#+id/idbutton4"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/idbutton1" />
<Button
android:id="#+id/idbutton4"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#000"
android:foreground="?attr/selectableItemBackground"
android:padding="25dp"
android:text="BUTTON4"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="#+id/idAppointments"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/idbutton3"
app:layout_constraintTop_toBottomOf="#+id/idbutton2" />
<Button
android:id="#+id/idbutton5"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#f0eb79"
android:foreground="?attr/selectableItemBackground"
android:padding="25dp"
android:text="BUTTON5"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/idAppointments"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/idbutton3" />
<Button
android:id="#+id/idAppointments"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#000"
android:foreground="?attr/selectableItemBackground"
android:padding="25dp"
android:text="BUTTON6"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/idbutton5"
app:layout_constraintTop_toBottomOf="#+id/idbutton4" />
</android.support.constraint.ConstraintLayout>

How to resize table of buttons to work fine with all phones

Hello i'am trying to make a Tictactoy game my problem is in the layout design how to make it when the screen grows bigger the table and buttons inside become grow bigger and When the screen is smaller, the table and buttons inside become smaller not only the table
There is any way to fix this ?
The Correct one(my sccren)
The wrong one(when i change it to a smaller sccren)
,
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/darker_gray"
android:orientation="vertical"
tools:context="com.example.pc.tictactoyv1.act11">
<TableLayout
android:id="#+id/Table"
android:layout_width="357dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.42"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/linearLayout2"
app:layout_constraintVertical_bias="0.356">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<Button
android:id="#+id/Btn1"
android:layout_width="110dp"
android:layout_height="128dp"
android:layout_marginRight="5dp"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp"
tools:ignore="ButtonStyle" />
<Button
android:id="#+id/Btn2"
android:layout_width="110dp"
android:layout_height="128dp"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp"
android:textStyle="bold" />
<Button
android:id="#+id/Btn3"
android:layout_width="110dp"
android:layout_height="128dp"
android:layout_marginLeft="5dp"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp" />
android:textSize="24sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:weightSum="3">
<Button
android:id="#+id/Btn4"
android:layout_width="90dp"
android:layout_height="128dp"
android:layout_marginRight="5dp"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp" />
<Button
android:id="#+id/Btn5"
android:layout_width="110dp"
android:layout_height="128dp"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp" />
<Button
android:id="#+id/Btn6"
android:layout_width="110dp"
android:layout_height="128dp"
android:layout_marginLeft="5dp"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp" />
</TableRow>
</TableLayout>
You have several options:
ConstraintLayout with percentage guidelines
nested vertical and horizontal LinearLayouts with weights
creating a CustomView that handles the sizes in onMeasure
ImageViews with white rectangular background, set to fitXY and adjustViewBounds = true
These are just some options I came up with at the top of my head, there are many more. Pick whatever suits your needs best. For beginners probably the way with the ConstraintLayout is the easiest.
I still don't exactly know what you want, but I added an example, that scales evenly, using ConstraintLayout and chains. Also checkout the constraintDimensionRatio whick makes everything square. You might want to checkout Constraint Layout How To
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/darker_gray"
android:orientation="vertical">
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal">
</LinearLayout>
<android.support.constraint.ConstraintLayout
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/linearLayout2">
<Button
android:id="#+id/Btn4"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp"
app:layout_constraintBottom_toTopOf="#+id/Btn7"
app:layout_constraintEnd_toStartOf="#+id/Btn5"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Btn1" />
<Button
android:id="#+id/Btn9"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/Btn8"
app:layout_constraintTop_toBottomOf="#+id/Btn6" />
<Button
android:id="#+id/Btn2"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="#+id/Btn5"
app:layout_constraintEnd_toStartOf="#+id/Btn3"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/Btn1"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/Btn1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp"
app:layout_constraintBottom_toTopOf="#+id/Btn4"
app:layout_constraintEnd_toStartOf="#+id/Btn2"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ButtonStyle" />
<Button
android:id="#+id/Btn6"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp"
app:layout_constraintBottom_toTopOf="#+id/Btn9"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/Btn5"
app:layout_constraintTop_toBottomOf="#+id/Btn3" />
<Button
android:id="#+id/Btn5"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp"
app:layout_constraintBottom_toTopOf="#+id/Btn8"
app:layout_constraintEnd_toStartOf="#+id/Btn6"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/Btn4"
app:layout_constraintTop_toBottomOf="#+id/Btn2" />
<Button
android:id="#+id/Btn7"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/Btn8"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Btn4" />
<Button
android:id="#+id/Btn8"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/Btn9"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/Btn7"
app:layout_constraintTop_toBottomOf="#+id/Btn5" />
<Button
android:id="#+id/Btn3"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="#android:color/background_light"
android:onClick="SelectBtn"
android:textSize="40sp"
app:layout_constraintBottom_toTopOf="#+id/Btn6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/Btn2"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

Android layout_rowWeight for API 14 or lower

I'm trying to do something similar to this using as less code.
I did this using GridLayout. But layout_rowWeight requires API level 21 but I want to use API level 14.
How to do it at a lower API level or using another Layout?
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_columnSpan="3"
android:layout_gravity="fill"
android:layout_row="0"
android:layout_rowWeight="3"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_columnSpan="3"
android:layout_gravity="fill"
android:layout_row="1"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="#+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_columnWeight="1"
android:layout_gravity="fill"
android:layout_row="2"
android:layout_rowWeight="1"
android:clickable="false"
android:text="New Button" />
<Button
android:id="#+id/button24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_columnWeight="1"
android:layout_gravity="fill"
android:layout_row="3"
android:layout_rowWeight="1"
android:text="New Button" />
<Button
android:id="#+id/button27"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="2"
android:layout_columnWeight="1"
android:layout_gravity="fill"
android:layout_row="3"
android:layout_rowWeight="1"
android:text="New Button" />
<Button
android:id="#+id/button6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_columnWeight="1"
android:layout_gravity="fill"
android:layout_row="4"
android:layout_rowWeight="1"
android:text="New Button" />
<Button
android:id="#+id/button9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_columnWeight="1"
android:layout_gravity="fill"
android:layout_row="3"
android:layout_rowWeight="1"
android:text="New Button" />
<Button
android:id="#+id/button28"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_columnWeight="1"
android:layout_gravity="fill"
android:layout_row="4"
android:layout_rowWeight="1"
android:text="New Button" />
<Button
android:id="#+id/button29"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="2"
android:layout_columnWeight="1"
android:layout_gravity="fill"
android:layout_row="4"
android:layout_rowWeight="1"
android:text="New Button" />
<Button
android:id="#+id/button12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_columnWeight="1"
android:layout_gravity="fill"
android:layout_row="5"
android:layout_rowWeight="1"
android:text="New Button" />
<Button
android:id="#+id/button15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_columnWeight="1"
android:layout_gravity="fill"
android:layout_row="2"
android:layout_rowWeight="1"
android:text="New Button" />
<Button
android:id="#+id/button18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="2"
android:layout_columnWeight="1"
android:layout_gravity="fill"
android:layout_row="2"
android:layout_rowWeight="1"
android:text="New Button" />
<Button
android:id="#+id/button30"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_columnWeight="1"
android:layout_gravity="fill"
android:layout_row="5"
android:layout_rowWeight="1"
android:text="New Button" />
<Button
android:id="#+id/button34"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="2"
android:layout_columnWeight="1"
android:layout_gravity="fill"
android:layout_row="5"
android:layout_rowWeight="1"
android:text="New Button" />

Android - EditText positioning within a TableView row and colum

If someone could point out the really obvious setting im missing I would be grateful!
Im working on a screen layout that has rows and 3 columns. All I want to do is put a EditText control into the first row. Below is the code. Unfortunately I dont have the reputation to post a screen shot - sorry.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="75dp">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/textpin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_span="2"
android:layout_gravity="top"
android:cursorVisible="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:inputType="number"
android:textColor="#3399ff"
android:textSize="35sp" />
<Button
android:id="#+id/btnBack"
android:layout_width="150dp"
android:layout_height="130dp"
android:background="#fffafafa"
android:gravity="center_vertical|center_horizontal"
android:drawableTop="#drawable/ic_del"
android:textColor="#android:color/background_light"
android:textSize="40sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/btn1"
android:layout_width="150dp"
android:layout_height="130dp"
android:background="#fffafafa"
android:drawableTop="#drawable/ic_1"
android:textColor="#android:color/white"
android:textSize="30sp" />
<Button
android:id="#+id/btn2"
android:layout_width="150dp"
android:layout_height="130dp"
android:background="#fffafafa"
android:drawableTop="#drawable/ic_2"
android:textColor="#android:color/white"
android:textSize="30sp" />
<Button
android:id="#+id/btn3"
android:layout_width="150dp"
android:layout_height="130dp"
android:background="#fffafafa"
android:drawableTop="#drawable/ic_3"
android:textColor="#android:color/white"
android:textSize="30sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/btn4"
android:layout_width="150dp"
android:layout_height="130dp"
android:background="#fffafafa"
android:drawableTop="#drawable/ic_4"
android:textColor="#android:color/white"
android:textSize="30sp" />
<Button
android:id="#+id/btn5"
android:layout_width="150dp"
android:layout_height="130dp"
android:background="#fffafafa"
android:drawableTop="#drawable/ic_5"
android:textColor="#android:color/white"
android:textSize="30sp" />
<Button
android:id="#+id/btn6"
android:layout_width="150dp"
android:layout_height="130dp"
android:background="#fffafafa"
android:drawableTop="#drawable/ic_6"
android:textColor="#android:color/white"
android:textSize="30sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/btn7"
android:layout_width="150dp"
android:layout_height="130dp"
android:drawableTop="#drawable/ic_7"
android:background="#fffafafa"
android:textColor="#android:color/white"
android:textSize="30sp" />
<Button
android:id="#+id/btn8"
android:layout_width="150dp"
android:layout_height="130dp"
android:drawableTop="#drawable/ic_8"
android:background="#fffafafa"
android:textColor="#android:color/white"
android:textSize="30sp" />
<Button
android:id="#+id/btn9"
android:layout_width="150dp"
android:layout_height="130dp"
android:background="#fffafafa"
android:gravity="center"
android:drawableTop="#drawable/ic_9"
android:textColor="#android:color/white"
android:textSize="30sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/btn0"
android:layout_width="150dp"
android:layout_height="130dp"
android:layout_column="1"
android:drawableTop="#drawable/ic_0"
android:background="#fffafafa"
android:textColor="#android:color/white"
android:textSize="30sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/cancelB"
android:layout_width="150dp"
android:layout_height="130dp"
android:background="#fffafafa"
android:drawableTop="#drawable/ic_cancel"
android:textColor="#android:color/white"
android:textSize="25sp" />
<Button
android:id="#+id/confermB"
android:layout_width="150dp"
android:layout_height="130dp"
android:background="#fffafafa"
android:layout_column="2"
android:drawableTop="#drawable/ic_ok"
android:textColor="#android:color/white"
android:textSize="25sp" />
</TableRow>
</TableLayout>
Has anyone any ideas?
Thanks
Steve
After much messing around I found this fixed it :-
<EditText
android:id="#+id/textpin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_span="2"
android:layout_gravity="center_vertical"
android:cursorVisible="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:inputType="number"
android:textColor="#3399ff"
android:textSize="40sp" />

Resources