Android XML Layout Design - android

I have the xml design code of android. I want the design a bit different. Following is the relative layout what I have tried:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="sg.unitconverter.UnitFuel"
tools:showIn="#layout/activity_unit_fuel">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/item1"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/spinner1"
android:layout_below="#+id/item1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:entries="#array/area"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/item2"
android:layout_below="#+id/spinner1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/spinner2"
android:layout_below="#+id/item2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:entries="#array/area"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/clear"
android:id="#+id/clear"
android:layout_below="#+id/spinner2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:onClick="onClick"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/backspace"
android:id="#+id/backSpace"
android:layout_below="#+id/spinner2"
android:layout_toRightOf="#+id/clear"
android:layout_toEndOf="#+id/clear"
android:onClick="onClick"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="7"
android:id="#+id/num7"
android:layout_below="#+id/clear"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:onClick="onClick"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="8"
android:id="#+id/num8"
android:layout_alignBottom="#+id/num7"
android:layout_alignLeft="#+id/backSpace"
android:layout_alignStart="#+id/backSpace"
android:onClick="onClick"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="9"
android:id="#+id/num9"
android:layout_alignBottom="#+id/num8"
android:layout_toRightOf="#+id/num8"
android:layout_toEndOf="#+id/num8"
android:onClick="onClick"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="4"
android:id="#+id/num4"
android:layout_below="#+id/num7"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:nestedScrollingEnabled="true"
android:onClick="onClick" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5"
android:id="#+id/num5"
android:layout_alignBottom="#+id/num4"
android:layout_alignLeft="#+id/num8"
android:layout_alignStart="#+id/num8"
android:onClick="onClick" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6"
android:id="#+id/num6"
android:layout_alignBottom="#+id/num5"
android:layout_toRightOf="#+id/num5"
android:layout_toEndOf="#+id/num5"
android:onClick="onClick" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
android:id="#+id/num1"
android:layout_below="#+id/num4"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:onClick="onClick" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2"
android:id="#+id/num2"
android:layout_alignBottom="#+id/num1"
android:layout_alignLeft="#+id/num5"
android:layout_alignStart="#+id/num5"
android:onClick="onClick" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3"
android:id="#+id/num3"
android:layout_alignBottom="#+id/num2"
android:layout_toRightOf="#+id/num2"
android:layout_toEndOf="#+id/num2"
android:onClick="onClick" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:id="#+id/num0"
android:layout_below="#+id/num2"
android:layout_alignLeft="#+id/num2"
android:layout_alignStart="#+id/num2"
android:onClick="onClick" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="."
android:id="#+id/dot"
android:textSize="20dp"
android:onClick="onClick"
android:layout_alignTop="#+id/num0"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="="
android:id="#+id/equal"
android:onClick="onClick"
android:layout_alignTop="#+id/num0"
android:layout_alignLeft="#+id/num3"
android:layout_alignStart="#+id/num3" />
</RelativeLayout>
The output of above xml shows like the following:
But I want the design to be like the following:
Can anyone please help on this to do atleast something so that it would be great?

You're going to want to look at Google's Material design documentation.
https://material.io/guidelines/
For the Buttons:
https://material.io/guidelines/components/buttons.html

here you go.. this is just basic layout.. you need to color and custom it by your self
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal">
<TextView
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_gravity="top"
android:layout_marginTop="10dp"
android:text="From"/>
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="match_parent">
</Spinner>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal">
<TextView
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_gravity="top"
android:layout_marginTop="10dp"
android:text="To"/>
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="match_parent">
</Spinner>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"
style="?attr/borderlessButtonStyle" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

Related

draw vertical line that match_parent

I created an interface like this
Here is my XML code
<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"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFA5"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Team A"
android:textColor="#f00"
android:textSize="30dp" />
<TextView
android:id="#+id/team1_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="30dp"
android:layout_marginTop="30dp"
android:text="0"
android:textSize="45sp" />
<Button
android:id="#+id/btn_3_point_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:onClick="threePointA"
android:text="+3 Points" />
<Button
android:id="#+id/btn_2_point_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:onClick="twoPointA"
android:text="+2 Points" />
<Button
android:id="#+id/btn_1_point_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:onClick="onePointA"
android:text="Free Throw" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="340dp"
android:layout_margin="3dp"
android:background="#000" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Team B"
android:textColor="#00f"
android:textSize="30dp" />
<TextView
android:id="#+id/team2_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="30dp"
android:layout_marginTop="30dp"
android:text="0"
android:textSize="45sp" />
<Button
android:id="#+id/btn_3_point_b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:onClick="threePointB"
android:text="+3 Points" />
<Button
android:id="#+id/btn_2_point_b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:onClick="twoPointB"
android:text="+2 Points" />
<Button
android:id="#+id/btn_1_point_b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:onClick="onePointB"
android:text="Free Throw" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/btn_1_point_b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:onClick="reset"
android:text="RESET" />
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
my problem is that I had to hardcoded the "line" between the two scores
<View
android:layout_width="2dp"
android:layout_height="340dp"
android:layout_margin="3dp"
android:background="#000" />
Because when i set android:layout_height="match_parent" it take the full screen i think it's because the parents height="wrap_content"
Try this :
<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"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFA5"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Team A"
android:textColor="#f00"
android:textSize="30dp" />
<TextView
android:id="#+id/team1_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="30dp"
android:layout_marginTop="30dp"
android:text="0"
android:textSize="45sp" />
<Button
android:id="#+id/btn_3_point_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:onClick="threePointA"
android:text="+3 Points" />
<Button
android:id="#+id/btn_2_point_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:onClick="twoPointA"
android:text="+2 Points" />
<Button
android:id="#+id/btn_1_point_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:onClick="onePointA"
android:text="Free Throw" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:background="#000" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Team B"
android:textColor="#00f"
android:textSize="30dp" />
<TextView
android:id="#+id/team2_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="30dp"
android:layout_marginTop="30dp"
android:text="0"
android:textSize="45sp" />
<Button
android:id="#+id/btn_3_point_b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:onClick="threePointB"
android:text="+3 Points" />
<Button
android:id="#+id/btn_2_point_b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:onClick="twoPointB"
android:text="+2 Points" />
<Button
android:id="#+id/btn_1_point_b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:onClick="onePointB"
android:text="Free Throw" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/btn_1_point_b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:onClick="reset"
android:text="RESET" />
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
Make first two Linear Layout wrap_content
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFA5"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
And make view match_parent
<View
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:background="#000" />
It's because all your LinearLayout height must be wrap_content like :
<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"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFA5"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Team A"
android:textColor="#f00"
android:textSize="30dp" />
<TextView
android:id="#+id/team1_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="30dp"
android:layout_marginTop="30dp"
android:text="0"
android:textSize="45sp" />
<Button
android:id="#+id/btn_3_point_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:onClick="threePointA"
android:text="+3 Points" />
<Button
android:id="#+id/btn_2_point_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:onClick="twoPointA"
android:text="+2 Points" />
<Button
android:id="#+id/btn_1_point_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:onClick="onePointA"
android:text="Free Throw" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:background="#000" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Team B"
android:textColor="#00f"
android:textSize="30dp" />
<TextView
android:id="#+id/team2_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="30dp"
android:layout_marginTop="30dp"
android:text="0"
android:textSize="45sp" />
<Button
android:id="#+id/btn_3_point_b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:onClick="threePointB"
android:text="+3 Points" />
<Button
android:id="#+id/btn_2_point_b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:onClick="twoPointB"
android:text="+2 Points" />
<Button
android:id="#+id/btn_1_point_b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:onClick="onePointB"
android:text="Free Throw" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/btn_1_point_b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:onClick="reset"
android:text="RESET" />
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

How to make a numpad similar layout in android

How do i make the numpad layout as shown in the uploaded picture.
This is my current code which would not show anything in the design view. I used this code previously on other views which work but this time it does not work and none of the buttons were visible at all in the design view.And also how do i make the 0 button as it is in the picture. This is my 2nd time asking questions in stackoverflow so do let me know if my questions are not clear and also english is not my first language. Thank you in advanced!
Edit: I have to make this layout through xml coding and not the usual thing
where the users click on the textview and the numpad of the phone
shows up. I hope this clarify the doubts of my question. I have to
make the clear, cancel and exit button as well.
<LinearLayout 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:orientation="vertical"
android:weightSum="4"
android:layout_weight="4"
android:background="#drawable/background"
tools:context=".insert_amount">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="250dp">
<VideoView
android:id="#+id/videoview1"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
<TextView
android:id="#+id/textview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Player"
android:textSize="30dp"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
android:textColor="#color/white"
/>
<TextView
android:id="#+id/textview2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Display ID"
android:textSize="30dp"
android:textStyle="bold"
android:layout_marginTop="20dp"
android:layout_gravity="center_horizontal"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/content_box"
android:layout_marginTop="10dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/in"
android:layout_gravity="center_horizontal"
android:layout_marginTop="50dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Top Up Amount (IN)"
android:textSize="30dp"
android:layout_marginTop="10dp"
android:gravity="center_horizontal"
/>
<TextView
android:id="#+id/textviewnumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:hint="0.00"
android:textSize="40dp"
android:textStyle="bold"
android:gravity="center"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:weightSum="4"
android:orientation="horizontal">
<Button
android:id="#+id/button1"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#drawable/login_signoutbutton"
android:layout_height="fill_parent"
android:text="1"
/>
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent"
android:background="#drawable/login_signoutbutton"
android:text="2"
/>'
<Button
android:id="#+id/button3"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#drawable/login_signoutbutton"
android:layout_height="fill_parent"
android:text="3"
/>
<ImageButton
android:id="#+id/buttonclear"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:scaleType="fitCenter"
android:background="#drawable/login_signoutbutton"
android:src="#drawable/clear_button"
android:layout_margin="20dp"
/>
Try this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Player"
android:textColor="#FFFFFF" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="12345679"
android:textColor="#FFFFFF" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:src="#drawable/kid_goku" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:text="Top up Amount" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="Top up Amount" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_marginHorizontal="2dp"
android:layout_weight="1"
android:text="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_marginHorizontal="2dp"
android:layout_weight="1"
android:text="4" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="2dp"
android:layout_weight="1"
android:text="7" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_marginHorizontal="2dp"
android:layout_weight="1"
android:text="2" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_marginHorizontal="2dp"
android:layout_weight="1"
android:text="5" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_marginHorizontal="2dp"
android:layout_weight="1"
android:text="8" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="2dp"
android:layout_weight="1"
android:text="0" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_marginHorizontal="2dp"
android:layout_weight="1"
android:text="3" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_marginHorizontal="2dp"
android:layout_weight="1"
android:text="6" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_marginHorizontal="2dp"
android:layout_weight="1"
android:text="9" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.5"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginHorizontal="2dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="#9b5006"
android:drawableLeft="#drawable/ic_camera"
android:text="Clear"
android:textColor="#FFFFFF"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_marginHorizontal="2dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:background="#9b5006"
android:drawableLeft="#drawable/ic_camera"
android:text="Cancel"
android:textColor="#FFFFFF"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_marginHorizontal="2dp"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:background="#9b5006"
android:drawableLeft="#drawable/ic_camera"
android:text="Next"
android:textColor="#FFFFFF" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
OUTPUT
Your layout height exceeding the device display. You have to use ScrollView here. Also for making the number keypad using GridLayout link will be better choice and you can easily get '0' button position using this view.

Only a part of the buttons are displayed on linearlayout

I have a linearlayout and there are 3 buttons on each row that are filling the screen in both horizontal and vertical use but the buttons at the very bottom are not displayed as whole. This is the code...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
and the main xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
ScrollView does not cooperate with container CoordinateLayout.
When use CoordinateLayout its suggested to use
android.support.v4.widget.NestedScrollView for scrolling child
views.
Use android.support.v4.widget.NestedScrollView instead of ScrollView.
Here is the working code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="1"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="2"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="3"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="4"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="5"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="6"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="7"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="8"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="9"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="10"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="11"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="12"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="13"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="14"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="15"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="16"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="17"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="18"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="19"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="20"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="21"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="22"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="23"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="24"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="25"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="26"/>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp"
android:text="27"/>
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
OUTPUT:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Missing closing Tag at last for Linear Layout. Close the tag.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
try this code,it must work.
<?xml version="1.0" encoding="utf-8"?><ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:fillViewport="true" ><LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
<Button
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:textSize="15dp" />
</LinearLayout>
</LinearLayout>

Android: Place 4 buttons on RelativeLayout

I am trying to place 4 buttons to fill all the relative layout.. I want each button have width and height till the center of the RelativeLayout (with about 2dp space between them).. I don't think that I can explain it very good, so I have made an image and here is the code I have made... Any ideas?? Thank you!! The view right now is:
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp"
android:layout_marginTop="10dp"
android:id="#+id/textView" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/textView"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:id="#+id/relativeLayout"
android:weightSum="1">
<Button
android:text="Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/button"/>
<Button
android:text="Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/button2"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>
<Button
android:text="Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/button3"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:text="Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/button4"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
Try this code. I used two linear layouts instead of one relative layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp" />
<LinearLayout
android:orientation="horizontal"
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<Button
android:id="#+id/button"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="Button" />
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="Button" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
<Button
android:id="#+id/button3"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="Button" />
<Button
android:id="#+id/button4"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="Button" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp" />
<LinearLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="#+id/button"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp"
android:text="Button" />
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp"
android:text="Button" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="#+id/button3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp"
android:text="Button" />
<Button
android:id="#+id/button4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp"
android:text="Button" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

emulator output different from layout view in android

In the layout view my calculator program looks like this
But when I run my program, it looks like this
Why is this happening?
This is the layout file code:
<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"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<Button
android:id="#+id/button0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="#string/button_0"
android:onClick="onClkBn0" />
<Button
android:id="#+id/button_dot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/button0"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/button0"
android:text="#string/button_dot"
android:onClick="onClkBnDot"/>
<Button
android:id="#+id/button_res"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/button0"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/button_dot"
android:text="#string/button_res"
android:onClick="onClkBnRes"/>
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_above="#+id/button0"
android:text="#string/button_1"
android:onClick="onClkBn1"/>
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/button1"
android:layout_alignBottom="#+id/button1"
android:layout_toRightOf="#+id/button1"
android:layout_above="#+id/button_dot"
android:text="#string/button_2"
android:onClick="onClkBn2"/>
<Button
android:id="#+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/button2"
android:layout_toRightOf="#+id/button2"
android:layout_above="#+id/button_res"
android:text="#string/button_3"
android:onClick="onClkBn3"/>
<Button
android:id="#+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/button1"
android:layout_alignLeft="#+id/button1"
android:text="#string/button_4"
android:onClick="onClkBn4"/>
<Button
android:id="#+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/button4"
android:layout_alignLeft="#+id/button2"
android:text="#string/button_5"
android:onClick="onClkBn5"/>
<Button
android:id="#+id/button6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/button5"
android:layout_alignLeft="#+id/button3"
android:text="#string/button_6"
android:onClick="onClkBn6"/>
<Button
android:id="#+id/button7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/button4"
android:layout_alignLeft="#+id/button4"
android:text="#string/button_7"
android:onClick="onClkBn7"/>
<Button
android:id="#+id/button8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/button7"
android:layout_alignBottom="#+id/button7"
android:layout_toRightOf="#+id/button4"
android:text="#string/button_8"
android:onClick="onClkBn8"/>
<Button
android:id="#+id/button9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/button6"
android:layout_alignLeft="#+id/button6"
android:text="#string/button_9"
android:onClick="onClkBn9"/>
<Button
android:id="#+id/button_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/button_res"
android:layout_alignBottom="#+id/button_res"
android:layout_toRightOf="#+id/button_res"
android:text="#string/button_plus"
android:onClick="onClkBnPlus"/>
<Button
android:id="#+id/button_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/button_plus"
android:layout_alignLeft="#+id/button_plus"
android:text="#string/button_minus"
android:onClick="onClkBnMinus"/>
<Button
android:id="#+id/button_mul"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/button_minus"
android:layout_below="#+id/button9"
android:text="#string/button_mult"
android:onClick="onClkBnMult"/>
<Button
android:id="#+id/button_div"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/button9"
android:layout_alignLeft="#+id/button_mul"
android:text="#string/button_div"
android:onClick="onClkBnDiv"/>
<Button
android:id="#+id/button_can"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/button_div"
android:layout_centerVertical="true"
android:text="#string/button_cancel"
android:onClick="onClkBnCan"/>
<TextView
android:id="#+id/mantissa"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/button_can"
android:layout_alignParentLeft="true"
android:gravity="right"
android:text="#string/mantissa_default"
android:textIsSelectable="true"
android:textSize="30.0sp" />
<Button
android:id="#+id/button_off"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/mantissa"
android:layout_above = "#+id/button9"
android:layout_alignLeft="#+id/button9"
android:layout_toRightOf="#+id/button_can"
android:onClick="onClkBnOff"
android:text="#string/button_off" />
</RelativeLayout>
Your emulator is doing what you ask. This code :
android:layout_centerVertical="true"
puts the "c" button in the middle of the view, vertically. Then your mantissa view sits atop that view because of this:
android:layout_above="#+id/button_can"
Your off button is coerced into stretching from the mantissa view down to button_9 because of these lines:
android:layout_below="#+id/mantissa"
android:layout_above = "#+id/button9"
Here is one solution that should work for you:
<Button
android:id="#+id/button_can"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#id/button_div"
android:layout_above="#id/button_div"
android:text="#string/button_cancel"
android:onClick="onClkBnCan"/>
<TextView
android:id="#+id/mantissa"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#id/button_can"
android:layout_alignParentLeft="true"
android:gravity="right"
android:text="#string/mantissa_default"
android:textIsSelectable="true"
android:textSize="30.0sp" />
<Button
android:id="#+id/button_off"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above = "#id/button9"
android:layout_alignLeft="#id/button9"
android:layout_toRightOf="#id/button_can"
android:onClick="onClkBnOff"
android:text="#string/button_off" />
Also, you should only use the + in strings like "#+id/button9" on the first use of that label. Subsequent references for it would be "#id/button9"
I think you should better use a couple of LinearLayout to get the aspect you want.
Thanks to android:layout_weight you will be able to have the same layout aspect on several screen sizes and density.
Here is a code example showing what you want, the way you want on several screen sizes/devices density:
<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"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="#+id/mantissa"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:gravity="right"
android:text="#string/mantissa_default"
android:textIsSelectable="true"
android:textSize="30.0sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_below="#+id/mantissa"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:orientation="horizontal" >
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25" />
<Button
android:id="#+id/button_off"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBnOff"
android:text="#string/button_off" />
<Button
android:id="#+id/button_can"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBnCan"
android:text="#string/button_cancel" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:orientation="horizontal" >
<Button
android:id="#+id/button7"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBn7"
android:text="#string/button_7" />
<Button
android:id="#+id/button8"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBn8"
android:text="#string/button_8" />
<Button
android:id="#+id/button9"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBn9"
android:text="#string/button_9" />
<Button
android:id="#+id/button_div"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBnDiv"
android:text="#string/button_div" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:orientation="horizontal" >
<Button
android:id="#+id/button4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBn4"
android:text="#string/button_4" />
<Button
android:id="#+id/button5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBn5"
android:text="#string/button_5" />
<Button
android:id="#+id/button6"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBn6"
android:text="#string/button_6" />
<Button
android:id="#+id/button_mul"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBnMult"
android:text="#string/button_mult" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:orientation="horizontal" >
<Button
android:id="#+id/button1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_above="#+id/button0"
android:layout_weight="0.25"
android:onClick="onClkBn1"
android:text="#string/button_1" />
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_above="#+id/button_dot"
android:layout_weight="0.25"
android:onClick="onClkBn2"
android:text="#string/button_2" />
<Button
android:id="#+id/button3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBn3"
android:text="#string/button_3" />
<Button
android:id="#+id/button_minus"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBnMinus"
android:text="#string/button_minus" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:orientation="horizontal" >
<Button
android:id="#+id/button0"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBn0"
android:text="#string/button_0"/>
<Button
android:id="#+id/button_dot"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBnDot"
android:text="#string/button_dot" />
<Button
android:id="#+id/button_res"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBnRes"
android:text="#string/button_res"/>
<Button
android:id="#+id/button_plus"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:onClick="onClkBnPlus"
android:text="#string/button_plus" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

Categories

Resources