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" />
Related
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>
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.
I've been trying to get a gridlayout to work using:
<GridLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<TextView
android:text="sdfgh"
android:layout_height="wrap_content"
android:id="#+id/AvgGrade"
android:layout_row="2"
android:layout_column="1"
android:layout_rowWeight="0.2"
android:layout_columnWeight="0.5"
android:layout_gravity="fill"
android:textAlignment="gravity"
android:layout_columnSpan="1" />
<TextView
android:text="words"
android:layout_height="wrap_content"
android:id="#+id/Totals"
android:layout_row="1"
android:layout_column="1"
android:textAlignment="gravity"
android:layout_rowWeight="0.2"
android:layout_columnWeight="0.5"
android:layout_gravity="fill"
android:layout_columnSpan="1" />
<TextView
android:text="words"
android:layout_height="wrap_content"
android:id="#+id/textView3"
android:layout_row="2"
android:layout_column="0"
android:textAlignment="center"
android:layout_rowWeight="0.2"
android:layout_columnWeight="0.5"
android:layout_gravity="fill"
android:layout_columnSpan="1" />
<TextView
android:text="words"
android:layout_height="wrap_content"
android:id="#+id/textView4"
android:layout_row="1"
android:layout_column="0"
android:layout_rowWeight="0.2"
android:layout_columnWeight="0.5"
android:layout_gravity="fill"
android:textAlignment="center"
android:layout_columnSpan="1" />
<TextView
android:text="words"
android:layout_height="wrap_content"
android:id="#+id/TotalAvg"
android:layout_row="0"
android:layout_column="1"
android:textAlignment="gravity"
android:layout_rowWeight="0.2"
android:layout_columnWeight="0.5"
android:layout_gravity="fill"
android:layout_columnSpan="1" />
<TextView
android:text="words"
android:layout_height="wrap_content"
android:id="#+id/textView6"
android:layout_row="0"
android:layout_column="0"
android:textAlignment="center"
android:layout_columnWeight="0.5"
android:layout_gravity="fill"
android:layout_columnSpan="1" />
</GridLayout>
My issue is that what the data is loads in the second column the size of the columns changes ever so slightly. I've tried left and center alignment and nothing seems stop the columns from changing. The user will be updating these values repeatedly and the slight 'jiggle' of the columns shifting looks really bad.
After much frustration I was unable to find a solution in the XML layout. However I did find a solution that seems to be working fairly well programatically.
I added a method called at the end of my OnCreate
public void ResizeTexts(){
Display display = getWindowManager().getDefaultDisplay();
DisplayMetrics outMetrics = new DisplayMetrics ();
display.getMetrics(outMetrics);
float density = getResources().getDisplayMetrics().density;
float dpWidth = (outMetrics.widthPixels / density);
text1.getLayoutParams().width = (int)dpWidth;
text2.getLayoutParams().width = (int)dpWidth;
text3.getLayoutParams().width = (int)dpWidth;
text4.getLayoutParams().width = (int)dpWidth;
text5.getLayoutParams().width = (int)dpWidth;
text6.getLayoutParams().width = (int)dpWidth;
}
Which i adapted from this link re-setting a TextView height programmatically
then in my XML layout I set it up with:
<GridLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<TextView
android:text="points"
android:layout_height="wrap_content"
android:layout_width="10dp"
android:id="#+id/text1"
android:layout_row="0"
android:layout_column="0"
android:textAlignment="textEnd"
/>
<TextView
android:text="totals"
android:layout_height="wrap_content"
android:layout_width="10dp"
android:id="#+id/text2"
android:layout_row="1"
android:layout_column="0"
android:textAlignment="textEnd"/>
<TextView
android:text="score"
android:layout_height="wrap_content"
android:id="#+id/text3"
android:layout_width="10dp"
android:layout_row="2"
android:layout_column="0"
android:textAlignment="textEnd"/>
<TextView
android:text="123.4"
android:layout_height="wrap_content"
android:id="#+id/text4"
android:layout_width="10dp"
android:layout_row="1"
android:layout_column="1"
android:textAlignment="textEnd"/>
<TextView
android:text="1.23"
android:layout_height="wrap_content"
android:id="#+id/text5"
android:layout_width="10dp"
android:layout_row="2"
android:layout_column="1"
android:textAlignment="textEnd"/>
<TextView
android:text="1234 "
android:layout_height="wrap_content"
android:id="#+id/text6"
android:layout_width="10dp"
android:layout_row="0"
android:layout_column="1"
android:textAlignment="textEnd"/>
</GridLayout>
*the layout widths in the xml layout I was using to try and 'break' it, not actually used.
Admittedly, i'm not sure if this is the 'best' way to do this. Personally I feel like the GridLayout XML should be able to do this on it's own. But, I couldn't figure it out.
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" />
this is my UI of my app and it works perfectly on devices with screen size from 3.2 inch to 4.0 inch but above that it shows unwanted space above capacitive buttons and the last line of buttons.
Any suggestion on how shall i remove it. There is no such issue on devices with screen size below 4.0 inch.
here is link to screen. here is my xml code
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="sans-serif-condensed-bold"
android:background="#EAC14D"
android:screenOrientation="portrait"
android:layout_marginTop="55dp"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal|numberSigned"
android:ems="10"
android:id="#+id/insert"
android:ellipsize="end"
android:gravity="right|center_vertical"
android:textSize="35sp"
android:background="#drawable/roundeditext"
android:hint="0"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:layout_above="#+id/floor"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="sin"
android:id="#+id/sin"
android:background="#drawable/normal_calculator_button_press"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="cos"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/cos"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="tan"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/tan"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="floor"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/floor"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="abs"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/abs"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="rand"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/random"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="asin"
android:id="#+id/asin"
android:background="#drawable/normal_calculator_button_press"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="acos"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/acos"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="atan"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/atan"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ceil"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/ceil"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="^2"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/square"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="sqrt"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/sqrt"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="sinh"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/sinh"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="cosh"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/cosh"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="tanh"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/tanh"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="fact"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/fact"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="^3"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/cube"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="cbrt"
android:background="#drawable/normal_calculator_button_press"
android:id="#+id/cbrt"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="7"
android:id="#+id/seven"
android:layout_gravity="center_vertical|fill_horizontal"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="8"
android:id="#+id/eight"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_gravity="center_vertical|fill_horizontal"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="9"
android:id="#+id/nine"
android:layout_gravity="center_vertical|fill_horizontal"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="%"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/mod"
android:layout_gravity="center_vertical|fill_horizontal"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="<"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/back"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="C"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/clear"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="4"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/four"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5"
android:id="#+id/five"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/six"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="*"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/mul"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="/"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/div"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ln"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/ln"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/one"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2"
android:id="#+id/two"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/three"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/plus"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/minus"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="log"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/log"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:text="0"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/zero"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="."
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:id="#+id/dot"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="("
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/cbracket"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=")"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/obracket"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="="
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/equal"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="pi"
android:background="#drawable/programmer_button_pressed"
android:textColor="#android:color/white"
android:id="#+id/pie"
android:textSize="#dimen/normal_layout_normal_calc_bottom_textsize"
android:layout_gravity="center_vertical|fill_horizontal"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>