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" />
Related
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 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>
The apps top component has 4 TableRows under a TableLayout and each has a nested TextView and a Switch.
Each of these is set to Visibility:visible
And they show as expected in the Design mode for all available resolutions say NexusS(4.0,480x800,hdpi)
but when started on my Marshmallow device of the same resolution and size, only the switches show up and in their correct positions, those 4 textviews dissappear..
(http://i.stack.imgur.com/xmPqk.png)
(http://i.stack.imgur.com/6UNBo.png)![on device]
Heres the relevant xml
<?xml version="1.0" encoding="utf-8"?>
<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:id="#+id/MainPage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/bb"
android:hapticFeedbackEnabled="false"
android:minHeight="320dp"
android:minWidth="240dp"
android:visibility="visible"
tools:context=".MainActivity">
<Button
android:id="#+id/play"
android:layout_width="120dp"
android:layout_height="34dp"
android:layout_marginBottom="188dp"
android:layout_marginEnd="205dp"
android:layout_marginStart="24dp"
android:background="#ad000000"
android:hapticFeedbackEnabled="false"
android:text="#string/playBtn"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textStyle="bold"
android:typeface="monospace"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.272"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="#+id/settings"
android:layout_width="120dp"
android:layout_height="38dp"
android:layout_marginTop="8dp"
android:background="#ad000000"
android:hapticFeedbackEnabled="false"
android:text="#string/setBtn"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textStyle="bold"
android:typeface="monospace"
android:visibility="visible"
app:layout_constraintStart_toStartOf="#+id/play"
app:layout_constraintTop_toBottomOf="#+id/play" />
<Button
android:id="#+id/quit"
android:layout_width="120dp"
android:layout_height="38dp"
android:layout_marginTop="8dp"
android:background="#ad000000"
android:hapticFeedbackEnabled="false"
android:text="#string/quitBtn"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textStyle="bold"
android:typeface="monospace"
android:visibility="visible"
app:layout_constraintStart_toStartOf="#+id/settings"
app:layout_constraintTop_toBottomOf="#+id/settings" />
<TextView
android:id="#+id/Title"
android:layout_width="wrap_content"
android:layout_height="178dp"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:fontFamily="#font/owaw"
android:textColor="#android:color/white"
android:textSize="120sp"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="#+id/play"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.418"
tools:text="#string/app_name" />
<TableLayout
android:id="#+id/OptionsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/black"
android:gravity="center_vertical|start"
android:orientation="vertical"
android:paddingEnd="0dp"
android:paddingStart="100dp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Title"
app:layout_constraintVertical_bias="0.0">
<TableRow
android:id="#+id/Option1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="24dp"
android:orientation="horizontal"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="#+id/Option2"
app:layout_constraintEnd_toEndOf="#+id/Option2"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="#+id/Option2"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:paddingBottom="20dp"
android:textAppearance="#style/TextAppearance.AppCompat.Button"
android:textColor="#android:color/white"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="visible"
tools:text="#string/opt1" />
<Switch
android:id="#+id/tutorialSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:allowUndo="true"
android:alpha="0.8"
android:background="#android:color/black"
android:checked="true"
android:hapticFeedbackEnabled="false"
android:padding="0dp"
android:showText="false"
android:splitTrack="false"
android:switchMinWidth="20dp" />
</TableRow>
<TableRow
android:id="#+id/Option2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="#+id/Option3"
app:layout_constraintEnd_toEndOf="#+id/Option3"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="#+id/Option3"
app:layout_constraintTop_toBottomOf="#+id/Option1">
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:paddingBottom="20dp"
android:textAppearance="#style/TextAppearance.AppCompat.Button"
android:textColor="#android:color/white"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="visible"
tools:text="#string/opt2" />
<Switch
android:id="#+id/musicSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:layout_marginEnd="-70dp"
android:allowUndo="true"
android:alpha="0.8"
android:background="#android:color/black"
android:checked="true"
android:hapticFeedbackEnabled="false"
android:padding="0dp"
android:showText="false"
android:splitTrack="false"
android:switchMinWidth="20dp" />
</TableRow>
<TableRow
android:id="#+id/Option3"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="#+id/Option4"
app:layout_constraintEnd_toEndOf="#+id/Option4"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="#+id/Option4"
app:layout_constraintTop_toBottomOf="#+id/Option2">
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:paddingBottom="20dp"
android:textAppearance="#style/TextAppearance.AppCompat.Button"
android:textColor="#android:color/white"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="visible"
tools:text="#string/opt3" />
<Switch
android:id="#+id/hapticSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:allowUndo="true"
android:alpha="0.8"
android:background="#android:color/black"
android:checked="false"
android:hapticFeedbackEnabled="false"
android:padding="0dp"
android:showText="false"
android:splitTrack="false"
android:switchMinWidth="20dp" />
</TableRow>
<TableRow
android:id="#+id/Option4"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="#+id/Option5"
app:layout_constraintEnd_toEndOf="#+id/Option5"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="#+id/Option5"
app:layout_constraintTop_toBottomOf="#+id/Option3">
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:paddingBottom="20dp"
android:textAppearance="#style/TextAppearance.AppCompat.Button"
android:textColor="#android:color/white"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="visible"
tools:text="#string/opt4" />
<Switch
android:id="#+id/sfxSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:allowUndo="true"
android:alpha="0.8"
android:background="#android:color/black"
android:checked="true"
android:hapticFeedbackEnabled="true"
android:padding="0dp"
android:showText="false"
android:splitTrack="false"
android:switchMinWidth="20dp" />
</TableRow>
<TableRow
android:id="#+id/Option5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Option4">
<TextView
android:id="#+id/saveOption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="60dp"
android:layout_marginTop="20dp"
android:clickable="true"
android:focusable="true"
android:hapticFeedbackEnabled="false"
android:paddingBottom="20dp"
android:textAppearance="#style/TextAppearance.AppCompat.Button"
android:textColor="#android:color/white"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="visible"
tools:text="#string/opt5" />
</TableRow>
</TableLayout>
</android.support.constraint.ConstraintLayout>
UPDATE:
I added the font family property to each of those and now the text is visible on device but I dont understand how it matters, since there is already a default option there.
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>
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>