I have 3 layouts, main.xml, layout1.xml, layout2.xml.
layout1.xml has around 10 text fields and layout2.xml has 4 buttons
In main.xml I am callling other 2 layouts as
<include layout="@layout/data_layout"/>
<include layout="@layout/button_layout"
android:layout_alignBottom="@layout/data_layout" />
Now my problem is both layout1.xml and layout2.xml are overlapping one above the another. But I need layout2.xml has to start at the bottom of layout1.xml
Any Ideas on this one?
Main_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/nieTxtState"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:padding="@dimen/padding_medium"
android:text="@string/state"
android:textSize="14dp" />
<TextView
android:id="@+id/nieTxtTNState"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/nieTxtState"
android:padding="@dimen/padding_medium"
android:text="@string/tnState"
android:textSize="14dp" />
<include
layout="@layout/data_layout"/>
<include
layout="@layout/button_layout"
android:layout_alignBottom="@layout/data_layout" />
</RelativeLayout>
data_layout.xml
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/light_blue"
android:orientation="vertical"
android:scrollbars="vertical" >
<TextView
android:id="@+id/nieTxtState"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:padding="@dimen/padding_medium"
android:text="@string/state"
android:textSize="14dp" />
<TextView
android:id="@+id/nieTxtTNState"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/nieTxtState"
android:padding="@dimen/padding_medium"
android:text="@string/tnState"
android:textSize="14dp" />
<TextView
android:id="@+id/txtViewDistrict"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/nieTxtTNState"
android:layout_marginLeft="5dp"
android:text="@string/district"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnDistrict"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewDistrict"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewHSS"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnDistrict"
android:layout_marginLeft="5dp"
android:text="@string/hssSite"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnHSS"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewHSS"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewAge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnHSS"
android:layout_marginLeft="5dp"
android:text="@string/age"
android:textColor="@color/black" />
<EditText
android:id="@+id/edtTxtAge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewAge"
android:layout_marginLeft="2dp"
android:hint="@string/hintAge"
android:inputType="number"
android:maxLength="2"
android:textSize="14dp" />
<TextView
android:id="@+id/txtViewLiteracy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/edtTxtAge"
android:layout_marginLeft="5dp"
android:text="@string/literacyStatus"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnLiteracy"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewLiteracy"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewPregnancy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnLiteracy"
android:layout_marginLeft="5dp"
android:text="@string/currentPregnancy"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnPregnancy"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewPregnancy"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewReferralSource"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnPregnancy"
android:layout_marginLeft="5dp"
android:text="@string/referralSource"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnReferralSource"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewReferralSource"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewResidence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnReferralSource"
android:layout_marginLeft="5dp"
android:text="@string/residecnePlace"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnResidence"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewResidence"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewDurationOfStay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnResidence"
android:layout_marginLeft="5dp"
android:text="@string/DurationOfStay"
android:textColor="@color/black" />
<EditText
android:id="@+id/edtTxtDurationOfYear"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_below="@id/txtViewDurationOfStay"
android:layout_marginLeft="2dp"
android:layout_marginRight="20dp"
android:hint="@string/hintYear"
android:inputType="number"
android:maxLength="4"
android:textSize="14dp" />
<EditText
android:id="@+id/edtTxtDurationOfMonth"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_below="@id/txtViewDurationOfStay"
android:layout_toRightOf="@id/edtTxtDurationOfYear"
android:hint="@string/hintMonth"
android:inputType="number"
android:maxLength="2"
android:textSize="14dp" />
<TextView
android:id="@+id/txtViewRespOccupation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/edtTxtDurationOfYear"
android:layout_marginLeft="5dp"
android:text="@string/respondentOccupation"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnRespOccupation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewRespOccupation"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewSpouseOccupation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnRespOccupation"
android:layout_marginLeft="5dp"
android:text="@string/spouseOccupation"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnSpouseOccupation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewSpouseOccupation"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewSpouseResidesAwayFromWife"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnSpouseOccupation"
android:layout_marginLeft="5dp"
android:text="@string/spouseResidesAwayFromWife"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnSpouseResidesAwayFromWife"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewSpouseResidesAwayFromWife"
android:layout_marginLeft="2dp" />
</RelativeLayout>
button_layout.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="bottom">
<Button
android:id="@+id/ancSaveBtn"
android:layout_width="80dp"
android:layout_height="35dp"
android:layout_alignParentLeft="true"
android:layout_marginTop="15dp"
android:text="@string/upload"
android:textSize="14dp" />
<Button
android:id="@+id/ancAddNewBtn"
android:layout_width="80dp"
android:layout_height="35dp"
android:layout_marginTop="15dp"
android:layout_toRightOf="@id/ancSaveBtn"
android:text="@string/addNew"
android:textSize="14dp" />
<Button
android:id="@+id/ancClearBtn"
android:layout_width="80dp"
android:layout_height="35dp"
android:layout_marginTop="15dp"
android:layout_toRightOf="@id/ancAddNewBtn"
android:text="@string/clear"
android:textSize="14dp" />
<Button
android:id="@+id/ancExitBtn"
android:layout_width="80dp"
android:layout_height="35dp"
android:layout_marginTop="15dp"
android:layout_toRightOf="@id/ancClearBtn"
android:text="@string/exit"
android:textSize="14dp" />
</RelativeLayout>
I have to do some walk around to get the right layout. Please if this is not what you are looking feel free to post here a screen shot that you would like to archive
main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include
android:id="@+id/layout_content_1"
android:layout_alignParentTop="true"
android:layout_below="@+id/layout_content_2"
layout="@layout/top_layout" />
<include
android:id="@+id/layout_content_2"
android:layout_above="@+id/layout_content_1"
layout="@layout/data_layout" />
<include
android:id="@+id/layout_content_3"
layout="@layout/button_layout" />
</RelativeLayout>
button_layout.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<Button
android:id="@+id/ancSaveBtn"
android:layout_width="80dp"
android:layout_height="35dp"
android:layout_marginTop="15dp"
android:text="upload"
android:textSize="14dp" />
<Button
android:id="@+id/ancAddNewBtn"
android:layout_width="80dp"
android:layout_height="35dp"
android:layout_marginTop="15dp"
android:text="new"
android:textSize="14dp" />
<Button
android:id="@+id/ancClearBtn"
android:layout_width="80dp"
android:layout_height="35dp"
android:layout_marginTop="15dp"
android:text="clear"
android:textSize="14dp" />
<Button
android:id="@+id/ancExitBtn"
android:layout_width="80dp"
android:layout_height="35dp"
android:layout_marginTop="15dp"
android:text="edit"
android:textSize="14dp" />
</LinearLayout>
</RelativeLayout>
data_layout.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="36dp"
android:layout_marginTop="36dp"
android:scrollbars="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:scrollbars="vertical" >
<TextView
android:id="@+id/nieTxtState"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:padding="@dimen/padding_medium"
android:text="state"
android:textSize="14dp" />
<TextView
android:id="@+id/nieTxtTNState"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/nieTxtState"
android:padding="@dimen/padding_medium"
android:text="tnState"
android:textSize="14dp" />
<TextView
android:id="@+id/txtViewDistrict"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/nieTxtTNState"
android:layout_marginLeft="5dp"
android:text="district"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnDistrict"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewDistrict"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewHSS"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnDistrict"
android:layout_marginLeft="5dp"
android:text="hssSite"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnHSS"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewHSS"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewAge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnHSS"
android:layout_marginLeft="5dp"
android:text="age"
android:textColor="@color/black" />
<EditText
android:id="@+id/edtTxtAge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewAge"
android:layout_marginLeft="2dp"
android:hint="hintAge"
android:inputType="number"
android:maxLength="2"
android:textSize="14dp" />
<TextView
android:id="@+id/txtViewLiteracy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/edtTxtAge"
android:layout_marginLeft="5dp"
android:text="literacyStatus"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnLiteracy"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewLiteracy"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewPregnancy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnLiteracy"
android:layout_marginLeft="5dp"
android:text="currentPregnancy"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnPregnancy"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewPregnancy"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewReferralSource"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnPregnancy"
android:layout_marginLeft="5dp"
android:text="referralSource"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnReferralSource"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewReferralSource"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewResidence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnReferralSource"
android:layout_marginLeft="5dp"
android:text="residecnePlace"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnResidence"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewResidence"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewDurationOfStay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnResidence"
android:layout_marginLeft="5dp"
android:text="DurationOfStay"
android:textColor="@color/black" />
<EditText
android:id="@+id/edtTxtDurationOfYear"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_below="@id/txtViewDurationOfStay"
android:layout_marginLeft="2dp"
android:layout_marginRight="20dp"
android:hint="hintYear"
android:inputType="number"
android:maxLength="4"
android:textSize="14dp" />
<EditText
android:id="@+id/edtTxtDurationOfMonth"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_below="@id/txtViewDurationOfStay"
android:layout_toRightOf="@id/edtTxtDurationOfYear"
android:hint="hintMonth"
android:inputType="number"
android:maxLength="2"
android:textSize="14dp" />
<TextView
android:id="@+id/txtViewRespOccupation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/edtTxtDurationOfYear"
android:layout_marginLeft="5dp"
android:text="respondentOccupation"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnRespOccupation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewRespOccupation"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewSpouseOccupation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnRespOccupation"
android:layout_marginLeft="5dp"
android:text="spouseOccupation"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnSpouseOccupation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewSpouseOccupation"
android:layout_marginLeft="2dp" />
<TextView
android:id="@+id/txtViewSpouseResidesAwayFromWife"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/spnSpouseOccupation"
android:layout_marginLeft="5dp"
android:text="spouseResidesAwayFromWife"
android:textColor="@color/black" />
<Spinner
android:id="@+id/spnSpouseResidesAwayFromWife"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtViewSpouseResidesAwayFromWife"
android:layout_marginLeft="2dp" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
top_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_gravity="top"
android:orientation="vertical" >
<TextView
android:id="@+id/nieTxtState"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/padding_medium"
android:text="123434343434"
android:textSize="14dp" />
<TextView
android:id="@+id/nieTxtTNState"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/nieTxtState"
android:padding="@dimen/padding_medium"
android:text="1233434343"
android:textSize="14dp" />
</RelativeLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With