here i have got a problem with my layout.xml.here i am trying to list full details of an event in here all the text overlaps on to each other when i am trying to edit it Through java file.As in the following pic i attached in the que.any help is thank full.
Layout.xml
<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=".Logout" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Event Name :"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/Location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_alignRight="#+id/Eventname"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView1"
android:layout_alignRight="#+id/textView1"
android:layout_below="#+id/textView1"
android:layout_marginTop="29dp"
android:text="Location :"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView2"
android:layout_marginTop="30dp"
android:text="Contact person :"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/Contact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView3"
android:layout_alignBottom="#+id/textView3"
android:layout_marginLeft="14dp"
android:layout_toRightOf="#+id/textView3"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView3"
android:layout_below="#+id/textView3"
android:layout_marginTop="40dp"
android:text="Start Date :"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/Start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView4"
android:layout_alignBottom="#+id/textView4"
android:layout_centerHorizontal="true"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView4"
android:layout_below="#+id/textView4"
android:layout_marginTop="34dp"
android:text="End Date :"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/End"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/Start"
android:layout_alignTop="#+id/textView5"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView5"
android:layout_below="#+id/textView5"
android:layout_marginTop="38dp"
android:text="Description :"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/Desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/Location"
android:layout_alignTop="#+id/textView6"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="HardcodedText" />
<Button
android:id="#+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textView6"
android:layout_centerHorizontal="true"
android:layout_marginTop="42dp"
android:text="CALL"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/Eventname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView2"
android:layout_toRightOf="#+id/textView3"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="HardcodedText" />
</RelativeLayout>
Try this..
<LinearLayout 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:orientation="vertical"
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=".Logout" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Event Name :"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/Eventname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Location :"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/Location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Contact person :"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/Contact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start Date :"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/Start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="End Date :"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/End"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description :"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/Desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="HardcodedText" />
</LinearLayout>
<Button
android:id="#+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="CALL"
tools:ignore="HardcodedText" />
</LinearLayout>
Related
I have a relative Layout inside a scroll view. I am adding text views as you can see in the picture. Now the problem is when the space is full and I am adding the button at the bottom, it is not showing properly. How can I see the button and the other content at the bottom ? Here is the xml file of my picture.
<?xml version="1.0" encoding="utf-8"?>
<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"
android:background="#436dbf"
tools:context="com.kamranchaudhary.pucitportal.Aggreagte">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:scrollbarStyle="insideOverlay"
android:scrollbarThumbVertical="#drawable/custom_bar"
android:layout_alignParentBottom="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Pucit Aggregate Calculator"
android:id="#+id/textView5"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textColor="#ffffff" />
<View
android:layout_width="300dp"
android:layout_height="1dip"
android:background="#ffffff"
android:layout_below="#+id/textView5"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:id="#+id/view" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Matric"
android:id="#+id/textView6"
android:layout_below="#+id/view"
android:layout_alignParentStart="true"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Obtained Marks"
android:id="#+id/textView7"
android:textColor="#ffffff"
android:layout_below="#+id/textView6"
android:layout_alignStart="#+id/view"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Total Marks"
android:id="#+id/textView8"
android:layout_below="#+id/textView7"
android:layout_alignStart="#+id/textView7"
android:textColor="#ffffff"
android:layout_marginTop="10dp" />
<View
android:layout_width="300dp"
android:layout_height="1dip"
android:background="#ffffff"
android:id="#+id/view2"
android:layout_below="#+id/textView8"
android:layout_alignStart="#+id/textView8"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Intermediate"
android:id="#+id/textView9"
android:layout_below="#+id/view2"
android:layout_alignParentStart="true"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Obtained Marks"
android:id="#+id/textView10"
android:layout_below="#+id/textView9"
android:layout_alignStart="#+id/view2"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Total Marks"
android:id="#+id/textView11"
android:textColor="#ffffff"
android:layout_below="#+id/textView10"
android:layout_alignStart="#+id/textView10"
android:layout_marginTop="10dp"/>
<View
android:layout_width="300dp"
android:layout_height="1dip"
android:background="#ffffff"
android:id="#+id/view3"
android:layout_below="#+id/textView11"
android:layout_alignStart="#+id/textView11"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="PUCIT Entry Test"
android:id="#+id/textView12"
android:layout_below="#+id/view3"
android:layout_alignParentStart="true"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Obtained Marks"
android:id="#+id/textView13"
android:layout_below="#+id/textView12"
android:layout_alignStart="#+id/view3"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Total Marks"
android:id="#+id/textView14"
android:layout_below="#+id/textView13"
android:layout_alignStart="#+id/textView13"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<View
android:layout_width="300dp"
android:layout_height="1dip"
android:background="#ffffff"
android:layout_below="#+id/textView14"
android:layout_alignStart="#+id/textView14"
android:layout_marginTop="10dp"
android:id="#+id/view4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Extras"
android:id="#+id/textView15"
android:layout_below="#+id/view4"
android:layout_alignParentStart="true"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Are You Hafiz e Quran ?"
android:id="#+id/textView16"
android:layout_below="#+id/textView15"
android:layout_alignStart="#+id/view4"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Intermediate passing Year"
android:id="#+id/textView17"
android:layout_below="#+id/textView16"
android:layout_alignStart="#+id/textView16"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/checkBox"
android:checked="false"
android:layout_alignTop="#+id/textView16"
android:layout_alignEnd="#+id/textView5" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/spinner"
android:layout_below="#+id/textView16"
android:layout_alignParentEnd="true"
android:layout_marginTop="13dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="#+id/button4"
android:layout_below="#+id/textView17"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</ScrollView>
It seems you are not using ScrollView correctly.
<?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:scrollbarStyle="insideOverlay"
android:scrollbarThumbVertical="#drawable/custom_bar"
tools:context="com.kamranchaudhary.pucitportal.Aggreagte">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Pucit Aggregate Calculator"
android:id="#+id/textView5"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textColor="#ffffff" />
<View
android:layout_width="300dp"
android:layout_height="1dip"
android:background="#ffffff"
android:layout_below="#+id/textView5"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:id="#+id/view" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Matric"
android:id="#+id/textView6"
android:layout_below="#+id/view"
android:layout_alignParentStart="true"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Obtained Marks"
android:id="#+id/textView7"
android:textColor="#ffffff"
android:layout_below="#+id/textView6"
android:layout_alignStart="#+id/view"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Total Marks"
android:id="#+id/textView8"
android:layout_below="#+id/textView7"
android:layout_alignStart="#+id/textView7"
android:textColor="#ffffff"
android:layout_marginTop="10dp" />
<View
android:layout_width="300dp"
android:layout_height="1dip"
android:background="#ffffff"
android:id="#+id/view2"
android:layout_below="#+id/textView8"
android:layout_alignStart="#+id/textView8"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Intermediate"
android:id="#+id/textView9"
android:layout_below="#+id/view2"
android:layout_alignParentStart="true"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Obtained Marks"
android:id="#+id/textView10"
android:layout_below="#+id/textView9"
android:layout_alignStart="#+id/view2"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Total Marks"
android:id="#+id/textView11"
android:textColor="#ffffff"
android:layout_below="#+id/textView10"
android:layout_alignStart="#+id/textView10"
android:layout_marginTop="10dp"/>
<View
android:layout_width="300dp"
android:layout_height="1dip"
android:background="#ffffff"
android:id="#+id/view3"
android:layout_below="#+id/textView11"
android:layout_alignStart="#+id/textView11"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="PUCIT Entry Test"
android:id="#+id/textView12"
android:layout_below="#+id/view3"
android:layout_alignParentStart="true"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Obtained Marks"
android:id="#+id/textView13"
android:layout_below="#+id/textView12"
android:layout_alignStart="#+id/view3"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Total Marks"
android:id="#+id/textView14"
android:layout_below="#+id/textView13"
android:layout_alignStart="#+id/textView13"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<View
android:layout_width="300dp"
android:layout_height="1dip"
android:background="#ffffff"
android:layout_below="#+id/textView14"
android:layout_alignStart="#+id/textView14"
android:layout_marginTop="10dp"
android:id="#+id/view4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Extras"
android:id="#+id/textView15"
android:layout_below="#+id/view4"
android:layout_alignParentStart="true"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Are You Hafiz e Quran ?"
android:id="#+id/textView16"
android:layout_below="#+id/textView15"
android:layout_alignStart="#+id/view4"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Intermediate passing Year"
android:id="#+id/textView17"
android:layout_below="#+id/textView16"
android:layout_alignStart="#+id/textView16"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/checkBox"
android:checked="false"
android:layout_alignTop="#+id/textView16"
android:layout_alignEnd="#+id/textView5" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/spinner"
android:layout_below="#+id/textView16"
android:layout_alignParentEnd="true"
android:layout_marginTop="13dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="#+id/button4"
android:layout_below="#+id/textView17"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</ScrollView>
or try closing Parent RelativeLayout.
<?xml version="1.0" encoding="utf-8"?>
<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"
android:background="#436dbf"
tools:context="com.kamranchaudhary.pucitportal.Aggreagte">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:scrollbarStyle="insideOverlay"
android:scrollbarThumbVertical="#drawable/custom_bar"
android:layout_alignParentBottom="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Pucit Aggregate Calculator"
android:id="#+id/textView5"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textColor="#ffffff" />
<View
android:layout_width="300dp"
android:layout_height="1dip"
android:background="#ffffff"
android:layout_below="#+id/textView5"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:id="#+id/view" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Matric"
android:id="#+id/textView6"
android:layout_below="#+id/view"
android:layout_alignParentStart="true"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Obtained Marks"
android:id="#+id/textView7"
android:textColor="#ffffff"
android:layout_below="#+id/textView6"
android:layout_alignStart="#+id/view"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Total Marks"
android:id="#+id/textView8"
android:layout_below="#+id/textView7"
android:layout_alignStart="#+id/textView7"
android:textColor="#ffffff"
android:layout_marginTop="10dp" />
<View
android:layout_width="300dp"
android:layout_height="1dip"
android:background="#ffffff"
android:id="#+id/view2"
android:layout_below="#+id/textView8"
android:layout_alignStart="#+id/textView8"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Intermediate"
android:id="#+id/textView9"
android:layout_below="#+id/view2"
android:layout_alignParentStart="true"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Obtained Marks"
android:id="#+id/textView10"
android:layout_below="#+id/textView9"
android:layout_alignStart="#+id/view2"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Total Marks"
android:id="#+id/textView11"
android:textColor="#ffffff"
android:layout_below="#+id/textView10"
android:layout_alignStart="#+id/textView10"
android:layout_marginTop="10dp"/>
<View
android:layout_width="300dp"
android:layout_height="1dip"
android:background="#ffffff"
android:id="#+id/view3"
android:layout_below="#+id/textView11"
android:layout_alignStart="#+id/textView11"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="PUCIT Entry Test"
android:id="#+id/textView12"
android:layout_below="#+id/view3"
android:layout_alignParentStart="true"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Obtained Marks"
android:id="#+id/textView13"
android:layout_below="#+id/textView12"
android:layout_alignStart="#+id/view3"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Total Marks"
android:id="#+id/textView14"
android:layout_below="#+id/textView13"
android:layout_alignStart="#+id/textView13"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<View
android:layout_width="300dp"
android:layout_height="1dip"
android:background="#ffffff"
android:layout_below="#+id/textView14"
android:layout_alignStart="#+id/textView14"
android:layout_marginTop="10dp"
android:id="#+id/view4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Extras"
android:id="#+id/textView15"
android:layout_below="#+id/view4"
android:layout_alignParentStart="true"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Are You Hafiz e Quran ?"
android:id="#+id/textView16"
android:layout_below="#+id/textView15"
android:layout_alignStart="#+id/view4"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Intermediate passing Year"
android:id="#+id/textView17"
android:layout_below="#+id/textView16"
android:layout_alignStart="#+id/textView16"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/checkBox"
android:checked="false"
android:layout_alignTop="#+id/textView16"
android:layout_alignEnd="#+id/textView5" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/spinner"
android:layout_below="#+id/textView16"
android:layout_alignParentEnd="true"
android:layout_marginTop="13dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="#+id/button4"
android:layout_below="#+id/textView17"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
I trying to design android listView like image below
But I get this
How to make the timeOut display beside timeIn and have a line between timeIn and timeOut ? Thanks.
xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="6dip">
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Description : "
android:layout_below="#+id/textView3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView2"
android:layout_below="#+id/Project"
android:text=" Progress : "/>
<TextView
android:id="#+id/Project"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text=" Project "
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="#+id/Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_toRightOf="#+id/textView2"
android:text="TextView" />
<TextView
android:id="#+id/Percentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView3"
android:layout_alignBottom="#+id/textView3"
android:layout_toRightOf="#+id/textView3"
android:text="TextView" />
<TextView
android:id="#+id/in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TimeIn"
android:paddingLeft="80dp"
android:layout_toRightOf="#+id/Project"
android:layout_alignParentRight="true"
android:layout_marginRight="64dp" />
<TextView
android:id="#+id/out"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TimeOut"
android:layout_toRightOf="#+id/in"
android:layout_alignParentRight="true" />
</RelativeLayout>
Please try this xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="#dimen/activity_horizontal_margin">
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/textView3"
android:text="Description : "/>
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView2"
android:layout_below="#+id/Project"
android:text="Progress : "/>
<TextView
android:id="#+id/Project"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="Project "
android:textColor="#color/colorBlack"
android:textStyle="bold"/>
<TextView
android:id="#+id/Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_toRightOf="#+id/textView2"
android:text="TextView"/>
<TextView
android:id="#+id/Percentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView3"
android:layout_alignBottom="#+id/textView3"
android:layout_toRightOf="#+id/textView3"
android:text="TextView"/>
<TextView
android:id="#+id/in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/out"
android:text="TimeIn | "/>
<TextView
android:id="#+id/out"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="TimeOut"/>
</RelativeLayout>
Hope it will help..!!
You are using android:layout_alignParentRight="true" for both your #+id/out and #+id/in TextViews.
Use it only for the one that would appear on the right, which in your case is timeOut. Timein TextView should use android:layout_toLeftOf of timeout TextView.
If you want to use a line between them, you can either use another TextView with "|" between them, or you can draw a View there.
Try this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#android:color/darker_gray"
android:padding="6dip">
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/textView3"
android:text=" Description : "
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView2"
android:layout_below="#+id/Project"
android:text=" Progress : "
android:textColor="#android:color/black" />
<TextView
android:id="#+id/Project"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text=" Project "
android:textColor="#android:color/black"
android:textStyle="bold" />
<TextView
android:id="#+id/Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_toRightOf="#+id/textView2"
android:text="TextView"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/Percentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView3"
android:layout_alignBottom="#+id/textView3"
android:layout_toRightOf="#+id/textView3"
android:text="TextView"
android:textColor="#android:color/black" />
<LinearLayout
android:id="#+id/container"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="#+id/in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/line"
android:text="TimeIn"
android:textColor="#android:color/black" />
<LinearLayout
android:id="#+id/line"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_toLeftOf="#+id/out"
android:background="#android:color/black"
android:orientation="horizontal">
</LinearLayout>
<TextView
android:id="#+id/out"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="TimeOut"
android:textColor="#android:color/black" />
</LinearLayout>
</RelativeLayout>
Output of this code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="6dip">
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/textView3"
android:text=" Description : " />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView2"
android:layout_below="#+id/Project"
android:text=" Progress : " />
<TextView
android:id="#+id/Project"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text=" Project "
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:orientation="horizontal">
<TextView
android:id="#+id/in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TimeIn" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" | " />
<TextView
android:id="#+id/out"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TimeOut" />
</LinearLayout>
I m using android studio 1.0.... In design ,my screen is get filled and when it runs it needs to scroll down but its not ... I tried previous answers an add scroll view in layout but there is error ( Scroll view can host only one child) enter code here
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/ScrollView">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="INTRODUCTION:"
android:id="#+id/heading1"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textAlignment="center"
android:phoneNumber="false"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/Introduction"
android:id="#+id/textView2"
android:layout_below="#+id/heading1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="HYDROCARBON:"
android:id="#+id/textView3"
android:layout_below="#+id/textView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/hydrocarbon"
android:id="#+id/textView4"
android:layout_below="#+id/textView3"
android:layout_alignLeft="#+id/textView2"
android:layout_alignStart="#+id/textView2" />
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:id="#+id/imageView"
android:layout_below="#+id/textView4"
android:layout_centerHorizontal="true"
android:src="#drawable/ethane"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="TYPES OF HYDROCARBON:"
android:id="#+id/textView5"
android:layout_below="#+id/imageView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/types"
android:id="#+id/textView6"
android:layout_below="#+id/textView5"
android:layout_alignLeft="#+id/textView4"
android:layout_alignStart="#+id/textView4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Alkane"
android:id="#+id/textView7"
android:layout_below="#+id/textView6"
android:layout_alignLeft="#+id/textView6"
android:layout_alignStart="#+id/textView6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Alkene"
android:id="#+id/textView8"
android:layout_below="#+id/textView7"
android:layout_alignLeft="#+id/textView7"
android:layout_alignStart="#+id/textView7" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Alkyne"
android:id="#+id/textView9"
android:layout_below="#+id/textView8"
android:layout_alignLeft="#+id/textView8"
android:layout_alignStart="#+id/textView8" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BACK"
android:id="#+id/button2"
android:onClick="mainPage"
android:layout_below="#+id/textView9"
android:layout_alignRight="#+id/textView8"
android:layout_alignEnd="#+id/textView8" />
This should help
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/ScrollView">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/RelativeLayout">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="INTRODUCTION:"
android:id="#+id/heading1"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textAlignment="center"
android:phoneNumber="false"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/Introduction"
android:id="#+id/textView2"
android:layout_below="#+id/heading1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="HYDROCARBON:"
android:id="#+id/textView3"
android:layout_below="#+id/textView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/hydrocarbon"
android:id="#+id/textView4"
android:layout_below="#+id/textView3"
android:layout_alignLeft="#+id/textView2"
android:layout_alignStart="#+id/textView2" />
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:id="#+id/imageView"
android:layout_below="#+id/textView4"
android:layout_centerHorizontal="true"
android:src="#drawable/ethane" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="TYPES OF HYDROCARBON:"
android:id="#+id/textView5"
android:layout_below="#+id/imageView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/types"
android:id="#+id/textView6"
android:layout_below="#+id/textView5"
android:layout_alignLeft="#+id/textView4"
android:layout_alignStart="#+id/textView4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Alkane"
android:id="#+id/textView7"
android:layout_below="#+id/textView6"
android:layout_alignLeft="#+id/textView6"
android:layout_alignStart="#+id/textView6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Alkene"
android:id="#+id/textView8"
android:layout_below="#+id/textView7"
android:layout_alignLeft="#+id/textView7"
android:layout_alignStart="#+id/textView7" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Alkyne"
android:id="#+id/textView9"
android:layout_below="#+id/textView8"
android:layout_alignLeft="#+id/textView8"
android:layout_alignStart="#+id/textView8" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BACK"
android:id="#+id/button2"
android:onClick="mainPage"
android:layout_below="#+id/textView9"
android:layout_alignRight="#+id/textView8"
android:layout_alignEnd="#+id/textView8" />
</RelativeLayout>
</ScrollView>
Scroll view tag can have only one child element
Put your content of scroll view in linear layout.
<ScrollView>
<LinearLayout>
.......
.......
.....
</LinearLayout>
</ScrollView>
For app having:
Target: API 8 or Android Froyo.
The emulator: Android GingerBread 2.0.3.
App reads the data from the file from /sdcard which is supposed to be shown in Gridview layouts. But, in runtime the arrangement is distorted in landscape and portrait layout orientations.
The layout seems perfect while design time as in Image#1, but during the run time it is as seen in the Image#2.
And here is my XML for the Layout for landscape orientation:
<LinearLayout
android:id="#+id/LinearLayoutInside"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/button2"
android:orientation="vertical"
android:background="#drawable/border_bkgrnd" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView12"
android:layout_below="#+id/TextView12"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/TextView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView11"
android:layout_alignRight="#+id/textView11"
android:layout_alignTop="#+id/TextView22"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txtTitlev1"
android:layout_below="#+id/txtTitlev1"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/TextView31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txtTitlev3"
android:layout_alignParentRight="true"
android:layout_below="#+id/txtTitlev3"
android:text="#string/strNA"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
<TextView
android:id="#+id/TextView33"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/TextView23"
android:layout_alignBottom="#+id/TextView23"
android:layout_alignLeft="#+id/TextView32"
android:layout_alignParentRight="true"
android:text="#string/strNA"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/txtTitlev1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/TextView21"
android:layout_alignParentLeft="true"
android:fontFamily="Roboto-BoldCondensed.ttf"
android:text="#string/ttlLeadid"
android:textColor="#color/Turquoise4"
android:layout_weight="1"
android:textSize="20sp"
android:textStyle="bold|normal"
android:typeface="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/TextView32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView31"
android:layout_alignParentRight="true"
android:layout_below="#+id/TextView31"
android:text="#string/strNA"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/TextView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView21"
android:layout_below="#+id/TextView21"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/TextView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView22"
android:layout_below="#+id/TextView22"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/txtTitlev3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:fontFamily="Roboto-BoldCondensed.ttf"
android:text="#string/ttlContact"
android:textColor="#color/Turquoise4"
android:textSize="20sp"
android:layout_weight="1"
android:textStyle="bold|normal" />
<TextView
android:id="#+id/txtTitlev2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:fontFamily="Roboto-BoldCondensed.ttf"
android:text="#string/ttlName"
android:textColor="#color/Turquoise4"
android:textSize="20sp"
android:layout_weight="1"
android:textStyle="bold|normal" />
<TextView
android:id="#+id/TextView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/TextView32"
android:layout_centerHorizontal="true"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
android:layout_weight="1"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>
[EDIT]
Is there any other alternative for arrangement?
Thanks in advance...
why dont you try using it through the RelativeLayout.layoutparams and the relative layout java coding.
you can do this using any layout for example here i am using a linear layout
Textview hname, game,time;
hname = new TextView(context);
game =new TextView(context);
time = new TextView(context);
LinearLayout ll = new LinearLayout(context);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(600, 100);
//add the settext here for ur textviews
ll.addView(hname, lp);
ll.addView(game, lp);
ll.addView(time, lp);
setcontentview(ll);
Try doing this with your RelativeLayout. I added 4 LinearLayouts in your RelativeLayout, all with a weightSum of 3 and moved your TextViews accordingly. I also set their layout_weight parameters to 1 so that they will be stretched across the screen.
I did not test this but it should work.
EDIT : I changed the RelativeLayout to a LinearLayout seeing that all your views are below eachother
<LinearLayout
android:id="#+id/LinearLayoutInside"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/button2"
android:orientation="vertical"
android:background="#drawable/border_bkgrnd" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView12"
android:layout_below="#+id/TextView12"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/TextView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView11"
android:layout_alignRight="#+id/textView11"
android:layout_alignTop="#+id/TextView22"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txtTitlev1"
android:layout_below="#+id/txtTitlev1"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/TextView31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txtTitlev3"
android:layout_alignParentRight="true"
android:layout_below="#+id/txtTitlev3"
android:text="#string/strNA"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
<TextView
android:id="#+id/TextView33"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/TextView23"
android:layout_alignBottom="#+id/TextView23"
android:layout_alignLeft="#+id/TextView32"
android:layout_alignParentRight="true"
android:text="#string/strNA"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/txtTitlev1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/TextView21"
android:layout_alignParentLeft="true"
android:fontFamily="Roboto-BoldCondensed.ttf"
android:text="#string/ttlLeadid"
android:textColor="#color/Turquoise4"
android:layout_weight="1"
android:textSize="20sp"
android:textStyle="bold|normal"
android:typeface="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/TextView32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView31"
android:layout_alignParentRight="true"
android:layout_below="#+id/TextView31"
android:text="#string/strNA"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/TextView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView21"
android:layout_below="#+id/TextView21"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/TextView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView22"
android:layout_below="#+id/TextView22"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/txtTitlev3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:fontFamily="Roboto-BoldCondensed.ttf"
android:text="#string/ttlContact"
android:textColor="#color/Turquoise4"
android:textSize="20sp"
android:layout_weight="1"
android:textStyle="bold|normal" />
<TextView
android:id="#+id/txtTitlev2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:fontFamily="Roboto-BoldCondensed.ttf"
android:text="#string/ttlName"
android:textColor="#color/Turquoise4"
android:textSize="20sp"
android:layout_weight="1"
android:textStyle="bold|normal" />
<TextView
android:id="#+id/TextView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/TextView32"
android:layout_centerHorizontal="true"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
android:layout_weight="1"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>
You can use a layout something like this. I used table layout with 3 rows. The first row shows column heading and other rows shows data.
<?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" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:stretchColumns="*" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp" >
<TextView
android:id="#+id/ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ID"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Contact"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="12"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name 1"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1234567"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="25"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name 2"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="594751"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
</TableLayout>
</LinearLayout>
I want a page which has a static header and footer with scrollable content inside. This is my layout:
<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"
tools:context=".MainActivity" >
<LinearLayout
android:id="#+id/headerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/sendfunds" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollablContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/footerView"
android:layout_below="#+id/headerView" >
<RelativeLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="26dp"
android:text="Balance"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="8pt"
android:textStyle="bold" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView1"
android:layout_centerHorizontal="true"
android:text="TextView" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_marginLeft="16dp"
android:layout_toRightOf="#+id/textView2"
android:text="TextView" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="34dp"
android:text="WHO ARE YOU SENDING MONEY TO?"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="8pt" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView4"
android:layout_marginTop="35dp"
android:text="Recipient Name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText1"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView5"
android:layout_alignBottom="#+id/textView5"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText1"
android:layout_marginTop="25dp"
android:text="Recipient Email"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView6"
android:layout_alignBottom="#+id/textView6"
android:layout_alignLeft="#+id/editText1"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/editText2"
android:layout_marginTop="37dp"
android:text="HOW MUCH DO YOU WANT TO SEND?"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="8pt" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView7"
android:layout_marginTop="34dp"
android:text="Amount"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView8"
android:layout_alignBottom="#+id/textView8"
android:layout_alignLeft="#+id/editText2"
android:layout_alignParentRight="true"
android:ems="10" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText3"
android:layout_marginTop="24dp"
android:text="Wallet Cat."
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editText3"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView9" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView9"
android:layout_alignBottom="#+id/textView9"
android:layout_alignLeft="#+id/spinner1"
android:layout_marginLeft="22dp"
android:text="TextView"
android:visibility="gone" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView9"
android:layout_marginTop="35dp"
android:text="Pay Ref."
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView11"
android:layout_alignLeft="#+id/spinner1"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView11"
android:layout_marginTop="27dp"
android:text="Detail Ref."
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView12"
android:layout_alignLeft="#+id/editText4"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView12"
android:layout_marginTop="39dp"
android:text="Date of Birth"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView13"
android:layout_alignLeft="#+id/editText5"
android:ems="10" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView13"
android:layout_marginTop="40dp"
android:text="Password"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView14"
android:layout_alignLeft="#+id/editText6"
android:layout_alignParentRight="true"
android:ems="10" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editText7"
android:layout_marginTop="37dp"
android:layout_toLeftOf="#+id/textView3"
android:text="Submit" />
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/footerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/wallet_ic" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView1"
android:src="#drawable/send_ic_hover" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView2"
android:src="#drawable/upload_ic" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView3"
android:src="#drawable/history1" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView4"
android:src="#drawable/more" />
</RelativeLayout>
</RelativeLayout>
With this I have the static header and footer but some of the scrollable content is missing. I tried increasing the height of the ScrollView and layout and fillViewport=true but no luck. How should I increase the height of the middle layout?
You can solve this by using a LinearLayout container instead of RelativeLayout container.
The container should have 3 children: Header, Content, and Footer. Where the Content's height is set to fill the remaining space. You can do that by using the weight attribute:
android:layout_height="0dp"
android:layout_weight="1"
Use this code:
<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:id="#+id/headerView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/sendfunds" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollablContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<RelativeLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- Your Content -->
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/footerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/wallet_ic" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView1"
android:src="#drawable/send_ic_hover" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView2"
android:src="#drawable/upload_ic" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView3"
android:src="#drawable/history1" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView4"
android:src="#drawable/more" />
</RelativeLayout>
</LinearLayout>
Notice that using
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true
is meaningless within LinearLayout. So this:
<LinearLayout
android:id="#+id/headerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/sendfunds" />
</LinearLayout>
is wrong.
try this layout with small change in your layout
<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"
tools:context=".MainActivity" >
<LinearLayout
android:id="#+id/headerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/sendfunds" />
</LinearLayout>
<RelativeLayout
android:id="#+id/footerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/wallet_ic" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView1"
android:src="#drawable/send_ic_hover" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView2"
android:src="#drawable/upload_ic" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView3"
android:src="#drawable/history1" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView4"
android:src="#drawable/more" />
</RelativeLayout>
<ScrollView
android:id="#+id/scrollablContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/footerView"
android:layout_below="#+id/headerView" >
<RelativeLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="26dp"
android:text="Balance"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="8pt"
android:textStyle="bold" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView1"
android:layout_centerHorizontal="true"
android:text="TextView" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_marginLeft="16dp"
android:layout_toRightOf="#+id/textView2"
android:text="TextView" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="34dp"
android:text="WHO ARE YOU SENDING MONEY TO?"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="8pt" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView4"
android:layout_marginTop="35dp"
android:text="Recipient Name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText1"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView5"
android:layout_alignBottom="#+id/textView5"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText1"
android:layout_marginTop="25dp"
android:text="Recipient Email"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView6"
android:layout_alignBottom="#+id/textView6"
android:layout_alignLeft="#+id/editText1"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/editText2"
android:layout_marginTop="37dp"
android:text="HOW MUCH DO YOU WANT TO SEND?"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="8pt" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView7"
android:layout_marginTop="34dp"
android:text="Amount"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView8"
android:layout_alignBottom="#+id/textView8"
android:layout_alignLeft="#+id/editText2"
android:layout_alignParentRight="true"
android:ems="10" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText3"
android:layout_marginTop="24dp"
android:text="Wallet Cat."
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editText3"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView9" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView9"
android:layout_alignBottom="#+id/textView9"
android:layout_alignLeft="#+id/spinner1"
android:layout_marginLeft="22dp"
android:text="TextView"
android:visibility="gone" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView9"
android:layout_marginTop="35dp"
android:text="Pay Ref."
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView11"
android:layout_alignLeft="#+id/spinner1"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView11"
android:layout_marginTop="27dp"
android:text="Detail Ref."
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView12"
android:layout_alignLeft="#+id/editText4"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView12"
android:layout_marginTop="39dp"
android:text="Date of Birth"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView13"
android:layout_alignLeft="#+id/editText5"
android:ems="10" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView13"
android:layout_marginTop="40dp"
android:text="Password"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView14"
android:layout_alignLeft="#+id/editText6"
android:layout_alignParentRight="true"
android:ems="10" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editText7"
android:layout_marginTop="37dp"
android:layout_toLeftOf="#+id/textView3"
android:text="Submit" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
try this
<LinearLayout 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"
tools:context=".MainActivity"
android:orientation=”vertical” >
<LinearLayout
android:id="#+id/headerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/sendfunds" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollablContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=1
>
<RelativeLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="26dp"
android:text="Balance"
android:textStyle="bold"
android:textSize="8pt"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView1"
android:layout_centerHorizontal="true"
android:text="TextView" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_marginLeft="16dp"
android:layout_toRightOf="#+id/textView2"
android:text="TextView" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="34dp"
android:text="WHO ARE YOU SENDING MONEY TO?"
android:textSize="8pt"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView4"
android:layout_marginTop="35dp"
android:text="Recipient Name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText1"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView5"
android:layout_alignBottom="#+id/textView5"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText1"
android:layout_marginTop="25dp"
android:text="Recipient Email"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView6"
android:layout_alignBottom="#+id/textView6"
android:layout_alignLeft="#+id/editText1"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/editText2"
android:layout_marginTop="37dp"
android:text="HOW MUCH DO YOU WANT TO SEND?"
android:textSize="8pt"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView7"
android:layout_marginTop="34dp"
android:text="Amount"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView8"
android:layout_alignBottom="#+id/textView8"
android:layout_alignLeft="#+id/editText2"
android:layout_alignParentRight="true"
android:ems="10" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText3"
android:layout_marginTop="24dp"
android:text="Wallet Cat."
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editText3"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView9" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView9"
android:layout_alignBottom="#+id/textView9"
android:layout_alignLeft="#+id/spinner1"
android:layout_marginLeft="22dp"
android:text="TextView"
android:visibility="gone" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView9"
android:layout_marginTop="35dp"
android:text="Pay Ref."
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView11"
android:layout_alignLeft="#+id/spinner1"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView11"
android:layout_marginTop="27dp"
android:text="Detail Ref."
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView12"
android:layout_alignLeft="#+id/editText4"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView12"
android:layout_marginTop="39dp"
android:text="Date of Birth"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView13"
android:layout_alignLeft="#+id/editText5"
android:ems="10" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView13"
android:layout_marginTop="40dp"
android:text="Password"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView14"
android:layout_alignLeft="#+id/editText6"
android:layout_alignParentRight="true"
android:ems="10" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editText7"
android:layout_marginTop="37dp"
android:layout_toLeftOf="#+id/textView3"
android:text="Submit" />
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/footerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/wallet_ic" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView1"
android:src="#drawable/send_ic_hover" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView2"
android:src="#drawable/upload_ic" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView3"
android:src="#drawable/history1" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView4"
android:src="#drawable/more" />
</RelativeLayout>
</LinearLayout >