split relative layout into two equal parts using linear layouts - android

I have a relative layout which contains two linear layouts. I want these two linear layouts to be placed in either halves of the relative layout containing them i.e. one to be positioned at top half and other at bottom half. Can anyone here help me with this. Here is the xml:
<RelativeLayout
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
android:background="#drawable/oneeventbkg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/Top_half_layout">
<ImageView
android:id="#+id/update_sn_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp" />
<TextView
android:id="#+id/update_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageView
android:id="#+id/update_message_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#id/update_sn_icon"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp" />
<TextView
android:id="#+id/update_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#id/update_message_pic"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:maxHeight="400dp"
android:scrollbars="vertical"
android:textColor="#android:color/white"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/bottom_half_layout">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_after"
android:visibility="invisible">
<TextView
android:id="#+id/toggle_like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/toggle_comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
<ListView
android:id="#+id/likes_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:layout_below="#id/toggle_after"
android:padding="20dp"
/>
<ListView
android:id="#+id/comments_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:layout_below="#id/toggle_after"
android:padding="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="#id/comments_list"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_content"
android:layout_alignParentBottom="true">
<TextView
android:id="#+id/like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

Try this..
<LinearLayout
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
android:background="#drawable/oneeventbkg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/Top_half_layout">
// Your Codes
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/bottom_half_layout">
// Your Codes
</LinearLayout>
</LinearLayout>
EDIT
<LinearLayout
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
android:background="#drawable/oneeventbkg" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/Top_half_layout">
// Your Codes
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/bottom_half_layout">
// Your Codes
</RelativeLayout>
</LinearLayout>

// Try this way,hope this will help you to solve your problem...
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="#drawable/oneeventbkg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/Top_half_layout"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/update_sn_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp" />
<TextView
android:id="#+id/update_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:textColor="#android:color/white"
android:layout_gravity="right"
android:textSize="14sp" />
</LinearLayout>
<ImageView
android:id="#+id/update_message_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp" />
<TextView
android:id="#+id/update_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:maxHeight="400dp"
android:scrollbars="vertical"
android:textColor="#android:color/white"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/bottom_half_layout"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_after"
android:visibility="invisible">
<TextView
android:id="#+id/toggle_like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/toggle_comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
<ListView
android:id="#+id/likes_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:padding="20dp" />
<ListView
android:id="#+id/comments_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:padding="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_content">
<TextView
android:id="#+id/like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

Related

Layout not showing properly on 7" tablets(Android)

I developed an android application with reference to Nexus 7 in android studio preview which is 7" in size. The app is running with designed layout in some 7" tablets but not running with desired layouts in some other 7" tablets.
[![Display with layout being mixed up (iball Slide 7" tablet)][1]][1].
[![Dispay with proper layout(Micromax canvas P290 )][2]][2]
This is the xml code for layout
<?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="match_parent"
android:orientation="vertical"
android:padding="15dp"
android:focusableInTouchMode="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingRight="15dp"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_below="#+id/chek"
android:background="#drawable/border_around"
android:layout_marginTop="10dp"
android:id="#+id/patient">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/date"
android:textSize="16sp"
android:text="Date :"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="#+id/dateTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/date"
android:text="2/11/2016"
android:layout_marginLeft="18dp"
/>
<View
android:layout_width="1dp"
android:layout_height="60dp"
android:background="#c0c0c0"
android:id="#+id/viewa"
android:layout_toRightOf="#+id/dateTxt"
android:layout_marginLeft="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/id"
android:textSize="16sp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/viewa"
android:text="IP No :"/>
<TextView
android:layout_width="230dp"
android:layout_height="wrap_content"
android:id="#+id/idTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/id"
android:text="133245"
android:layout_marginLeft="20dp"
/>
<View
android:layout_width="1dp"
android:layout_height="60dp"
android:background="#c0c0c0"
android:id="#+id/viewb"
android:layout_toRightOf="#+id/idTxt"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/patientName"
android:layout_below="#id/date"
android:layout_marginTop="10dp"
android:text="Patient Name :"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="#+id/patientNameTxt"
android:layout_below="#id/date"
android:textSize="16sp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/patientName"
android:text="Ravi Kumar"
android:layout_marginLeft="13dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/docName"
android:layout_below="#id/date"
android:layout_toRightOf="#+id/viewa"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:text="Primary Consultant :"/>
<TextView
android:layout_width="280dp"
android:layout_height="wrap_content"
android:id="#+id/docNameTxt"
android:textSize="16sp"
android:layout_below="#id/date"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/docName"
android:text="fddf"
android:layout_marginLeft="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/age"
android:textSize="16sp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/viewb"
android:text="Age :"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ageTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/age"
android:text="48"
android:layout_marginLeft="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/bednum"
android:textSize="16sp"
android:layout_below="#id/age"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/viewb"
android:text="Bed No :"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/bednumTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/bednum"
android:text="14"
android:layout_below="#id/age"
android:layout_marginTop="10dp"
android:layout_marginLeft="20dp"
/>
</RelativeLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#c0c0c0"
android:id="#+id/view1"
android:layout_below="#+id/patient"
android:layout_marginTop="20dp"/>
<ScrollView
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_below="#+id/view1"
android:layout_marginTop="30dp"
android:layout_marginBottom="10dp"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/line1"
android:layout_marginLeft="60dp"
>
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="#drawable/bed"
android:id="#+id/dailyassesment"
android:layout_toRightOf="#+id/nursingassessment"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Handover Checklist"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="#+id/calender"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/line3"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/line1">
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="#drawable/nursingassesment"
android:id="#+id/nursingcare"
android:clickable="true"
android:layout_toRightOf="#+id/doctor"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nursing Care Plans"
android:layout_below="#+id/nursingassessment"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_marginLeft="25dp"
android:layout_toRightOf="#+id/calender"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/line4"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/line3">
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="#drawable/graph"
android:id="#+id/vitalsigns"
android:layout_toRightOf="#+id/nursingassessment"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Vital Signs Input"
android:layout_below="#+id/vitalsigns"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_marginLeft="35dp"
android:layout_toRightOf="#+id/calender"/>
</LinearLayout>
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="vertical"-->
<!--android:id="#+id/line3"-->
<!--android:layout_marginLeft="20dp"-->
<!--android:layout_toRightOf="#+id/line2">-->
<!--<ImageView-->
<!--android:layout_width="180dp"-->
<!--android:layout_height="wrap_content"-->
<!--android:src="#drawable/nursecare"-->
<!--android:id="#+id/nursingassessment"-->
<!--android:clickable="true"-->
<!--android:layout_toRightOf="#+id/doctor"-->
<!--/>-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="Nursing Initial Assesments"-->
<!--android:layout_below="#+id/nursingassessment"-->
<!--android:layout_marginTop="10dp"-->
<!--android:layout_toRightOf="#+id/calender"/>-->
<!--</LinearLayout>-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/line5"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/line4">
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="#drawable/doctor"
android:id="#+id/doctor"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Doctors Notes"
android:layout_below="#+id/doctor"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_marginLeft="40dp"
android:layout_toRightOf="#+id/calender"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/line6"
android:layout_marginTop="30dp"
android:layout_marginLeft="60dp"
android:layout_below="#+id/line4"
>
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="#drawable/bed"
android:id="#+id/dailyassesment1"
android:layout_toRightOf="#+id/nursingassessment"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ISBAR Checklist-GW"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:textSize="17sp"
android:layout_toRightOf="#+id/calender"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/line7"
android:layout_marginTop="30dp"
android:layout_toRightOf="#+id/line6"
android:layout_marginLeft="30dp"
android:layout_below="#+id/line4"
>
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="#drawable/bed"
android:id="#+id/dailyassesment2"
android:layout_toRightOf="#+id/nursingassessment"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ISBAR-ICU"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_marginLeft="50dp"
android:layout_toRightOf="#+id/calender"/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
Try this library for working with multiple screen resolutions it is easy to use and simply documented with sample code source
Here you go! scrollview will fit all sizes!! for the upper section you need to create seprated layout for different sizes! You can do it from the top menu in the designer page in android studio "create other variation" or manage it programmatically
<?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="match_parent"
android:orientation="vertical"
android:padding="15dp"
android:focusableInTouchMode="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingRight="15dp"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_below="#+id/chek"
android:background="#drawable/delete"
android:layout_marginTop="10dp"
android:id="#+id/patient">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/date"
android:textSize="16sp"
android:text="Date :"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="#+id/dateTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/date"
android:text="2/11/2016"
android:layout_marginLeft="18dp"
/>
<View
android:layout_width="1dp"
android:layout_height="60dp"
android:background="#c0c0c0"
android:id="#+id/viewa"
android:layout_toRightOf="#+id/dateTxt"
android:layout_marginLeft="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/id"
android:textSize="16sp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/viewa"
android:text="IP No :"/>
<TextView
android:layout_width="230dp"
android:layout_height="wrap_content"
android:id="#+id/idTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/id"
android:text="133245"
android:layout_marginLeft="20dp"
/>
<View
android:layout_width="1dp"
android:layout_height="60dp"
android:background="#c0c0c0"
android:id="#+id/viewb"
android:layout_toRightOf="#+id/idTxt"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/patientName"
android:layout_below="#id/date"
android:layout_marginTop="10dp"
android:text="Patient Name :"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="#+id/patientNameTxt"
android:layout_below="#id/date"
android:textSize="16sp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/patientName"
android:text="Ravi Kumar"
android:layout_marginLeft="13dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/docName"
android:layout_below="#id/date"
android:layout_toRightOf="#+id/viewa"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:text="Primary Consultant :"/>
<TextView
android:layout_width="280dp"
android:layout_height="wrap_content"
android:id="#+id/docNameTxt"
android:textSize="16sp"
android:layout_below="#id/date"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/docName"
android:text="fddf"
android:layout_marginLeft="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/age"
android:textSize="16sp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/viewb"
android:text="Age :"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ageTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/age"
android:text="48"
android:layout_marginLeft="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/bednum"
android:textSize="16sp"
android:layout_below="#id/age"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/viewb"
android:text="Bed No :"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/bednumTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/bednum"
android:text="14"
android:layout_below="#id/age"
android:layout_marginTop="10dp"
android:layout_marginLeft="20dp"
/>
</RelativeLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#c0c0c0"
android:id="#+id/view1"
android:layout_below="#+id/patient"
android:layout_marginTop="20dp"/>
<ScrollView
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_below="#+id/view1"
android:layout_marginTop="30dp"
android:layout_marginBottom="10dp"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
>
<LinearLayout
android:id="#+id/firstRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/line1"
android:layout_weight="1"
android:layout_margin="5dp"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/delete"
android:id="#+id/dailyassesment"
android:layout_toRightOf="#+id/nursingassessment" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Handover Checklist"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_toRightOf="#+id/calender"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/line3"
android:layout_weight="1"
android:layout_margin="5dp"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/delete"
android:id="#+id/nursingcare"
android:clickable="true"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Nursing Care Plans"
android:textSize="17sp"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/line4"
android:layout_weight="1"
android:layout_margin="5dp"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/delete"
android:id="#+id/vitalsigns"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Vital Signs Input"
android:textSize="17sp"
android:gravity="center" />
</LinearLayout>
</LinearLayout>
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="vertical"-->
<!--android:id="#+id/line3"-->
<!--android:layout_marginLeft="20dp"-->
<!--android:layout_toRightOf="#+id/line2">-->
<!--<ImageView-->
<!--android:layout_width="180dp"-->
<!--android:layout_height="wrap_content"-->
<!--android:src="#drawable/nursecare"-->
<!--android:id="#+id/nursingassessment"-->
<!--android:clickable="true"-->
<!--android:layout_toRightOf="#+id/doctor"-->
<!--/>-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="Nursing Initial Assesments"-->
<!--android:layout_below="#+id/nursingassessment"-->
<!--android:layout_marginTop="10dp"-->
<!--android:layout_toRightOf="#+id/calender"/>-->
<!--</LinearLayout>-->
<LinearLayout
android:id="#+id/secondRow"
android:layout_below="#id/firstRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/line5"
android:layout_weight="1"
android:layout_margin="5dp"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/delete"
android:id="#+id/doctor"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Doctors Notes"
android:layout_below="#+id/doctor"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_toRightOf="#+id/calender"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/line6"
android:layout_weight="1"
android:layout_margin="5dp"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/delete"
android:id="#+id/dailyassesment1"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ISBAR Checklist-GW"
android:textSize="17sp"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/line7"
android:layout_weight="1"
android:layout_margin="5dp"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/delete"
android:id="#+id/dailyassesment2"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ISBAR-ICU"
android:textSize="17sp"
android:gravity="center" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Replace your scrollview with the following code
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/line1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
>
<ImageView
android:id="#+id/dailyassesment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Handover Checklist"
android:textSize="17sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/line3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="#+id/nursingcare"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Nursing Care Plans"
android:textSize="17sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/line4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="#+id/vitalsigns"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Vital Signs Input"
android:textSize="17sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/line5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="#+id/doctor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/doctor"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Doctors Notes"
android:textSize="17sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/line6"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_below="#+id/line4"
android:layout_marginTop="30dp"
android:orientation="vertical"
>
<ImageView
android:id="#+id/dailyassesment1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="ISBAR Checklist-GW"
android:textSize="17sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/line7"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_below="#+id/line4"
android:layout_marginLeft="30dp"
android:layout_marginTop="30dp"
android:orientation="vertical">
<ImageView
android:id="#+id/dailyassesment2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="ISBAR-ICU"
android:textSize="17sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"></LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
Note: Replace your images... I am adding default launcher icons

Background image is not visible if background of above of view is set

I am working on android app where I want to design layout such that "Success" image (20%) - Linearlayout should be top layout and 60%(RelativeLayout) should be in center layout and 20%(LinearLayout) should be on bottom layout.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/grey_background"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#color/grey_background"
android:gravity="center"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingTop="15dp">
<ImageView
android:id="#+id/trans_status_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/sucessfull" />
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/trans_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Transaction Successfull"
android:textColor="#color/black"
android:textSize="17sp" />
</LinearLayout>
<!--<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#color/white"
android:elevation="4dp"
>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="#drawable/bill_top" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="-5dp"
android:background="#color/white"
android:orientation="vertical"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/bene_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:orientation="vertical"
android:visibility="gone">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/sender_mobile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Mobile No."
android:textColor="#color/grey_text_color"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/bene_acc_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="A/C No."
android:textColor="#color/grey_text_color"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/trans_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Type"
android:textColor="#color/grey_text_color"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/bene_ifsc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="IFSC"
android:textColor="#color/grey_text_color"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#color/dark_grey"
android:padding="10dp">
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#color/white"
card_view:cardCornerRadius="5dp"
card_view:cardElevation="3dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/status_stamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:src="#drawable/success"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="10dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Transfer Amount:"
android:textColor="#color/grey_text_color"
android:textSize="11sp" />
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textColor="#color/black"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:background="#color/grey_background" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Transfer Charges:"
android:textColor="#color/grey_text_color"
android:textSize="11sp" />
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/charges"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center"
android:layout_marginLeft="10dp"
android:textColor="#color/black"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|right"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/amount_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:textColor="#color/black"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="Total Amount"
android:textColor="#color/grey_text_color"
android:textSize="11sp" />
</LinearLayout>
</FrameLayout>
</FrameLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#fafafa"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:text="Transaction details"
android:textColor="#color/black"
android:textSize="16sp" />
<ListView
android:id="#+id/trans_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#00000000"
android:divider="#null"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="8dp"
android:scrollbars="vertical" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="#drawable/bill_bottom"
android:visibility="visible" />
</LinearLayout>
<!--
</android.support.v7.widget.CardView>
-->
</LinearLayout>
</ScrollView>
</LinearLayout>
</FrameLayout>
If you want to divide the screen on the percentage basis, take LinearLayout as root and then use weight to divide the whole screen in the ratio as needed.
To bring the view on top, after your view is created and attached, add this line:
view.bringToFront();

Bottom bar hides the scrollview content

Below code has a bottom bar with two buttons which is fixed and not scrollable.
Above bottom bar the layout is scrollable. But the bottom content in the ScrollView hides behind the bottom bar.
I tried changing the parent layout which was not fixing the issue.
I don't know where I am wrong. Any help would be really thankfull.
Code as follows
<?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:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<View
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_marginTop="0dp"
android:background="#drawable/toolbar_dropshadow" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#fff"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical" >
<TextView
android:id="#+id/text_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<ImageView
android:id="#+id/image_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="20dp"
android:scaleType="fitXY" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:scrollbars="none">
<LinearLayout
android:id="#+id/imageall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"></LinearLayout>
</HorizontalScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:background="#bcbcbc"></TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="2">
<TextView
android:id="#+id/price_full_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/price_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="#000"
android:textSize="12sp" />
</LinearLayout>
<fone.adipoli.shopping.Rounded_textview
android:id="#+id/circle_txt"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginRight="70dp"
android:gravity="center"
android:padding="3dp"
android:text="" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#bcbcbc"></TextView>
<TextView
android:id="#+id/stock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:text="Check Availability"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/item_available_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3">
<EditText
android:id="#+id/enterpin"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="2"
android:background="#drawable/edittext_border"
android:cursorVisible="false"
android:hint="Enter Pincode"
android:inputType="number"
android:padding="5dp" />
<Button
android:id="#+id/pincheck"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center|right"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#000"
android:text="Check"
android:textColor="#color/white" />
</LinearLayout>
<RelativeLayout
android:id="#+id/chnge_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/item_available"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="14dp" />
<TextView
android:id="#+id/change_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="50dp"
android:text="Change\nPincode"
android:textColor="#color/blue"
android:textSize="14dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="Description :\n"
android:textColor="#000"
android:textSize="18dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/des_rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:orientation="vertical">
<WebView
android:id="#+id/text_des"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Full details"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<RelativeLayout
android:id="#+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/addtocart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Add to Cart"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:layout_width="2dp"
android:layout_height="wrap_content"></TextView>
<Button
android:id="#+id/buynow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Buy Now "
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
Remove whole of the first LinearLayout
Add the below line to your ScrollView
android:layout_above="#+id/bottom_bar"
This makes sure that your ScrollView ends before the bottom bar so theres no overlapping.
In your first LinearLayout add android:layout_above="#+id/bottom_bar"
this will help you
try this
Please try as below code
<?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:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar"
android:layout_alignParentBottom="true"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#id/toolbar"
android:layout_alignParentTop="true"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_marginTop="0dp"
android:background="#drawable/toolbar_dropshadow" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#fff"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical" >
<TextView
android:id="#+id/text_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<ImageView
android:id="#+id/image_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="20dp"
android:scaleType="fitXY" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:scrollbars="none">
<LinearLayout
android:id="#+id/imageall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"></LinearLayout>
</HorizontalScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:background="#bcbcbc"></TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="2">
<TextView
android:id="#+id/price_full_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/price_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="#000"
android:textSize="12sp" />
</LinearLayout>
<fone.adipoli.shopping.Rounded_textview
android:id="#+id/circle_txt"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginRight="70dp"
android:gravity="center"
android:padding="3dp"
android:text="" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#bcbcbc"></TextView>
<TextView
android:id="#+id/stock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:text="Check Availability"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/item_available_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3">
<EditText
android:id="#+id/enterpin"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="2"
android:background="#drawable/edittext_border"
android:cursorVisible="false"
android:hint="Enter Pincode"
android:inputType="number"
android:padding="5dp" />
<Button
android:id="#+id/pincheck"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center|right"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#000"
android:text="Check"
android:textColor="#color/white" />
</LinearLayout>
<RelativeLayout
android:id="#+id/chnge_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/item_available"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="14dp" />
<TextView
android:id="#+id/change_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="50dp"
android:text="Change\nPincode"
android:textColor="#color/blue"
android:textSize="14dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="Description :\n"
android:textColor="#000"
android:textSize="18dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/des_rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:orientation="vertical">
<WebView
android:id="#+id/text_des"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Full details"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<RelativeLayout
android:id="#+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/addtocart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Add to Cart"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:layout_width="2dp"
android:layout_height="wrap_content"></TextView>
<Button
android:id="#+id/buynow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Buy Now "
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
You should add tag android:layout_above="#id/bottom_bar" in your ScrollView
It will keep the scrolling above your bottom bar.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<View
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_marginTop="0dp"
android:background="#drawable/toolbar_dropshadow" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ScrollView
android:layout_above="#id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#fff"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical" >
<TextView
android:id="#+id/text_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<ImageView
android:id="#+id/image_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="20dp"
android:scaleType="fitXY" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:scrollbars="none">
<LinearLayout
android:id="#+id/imageall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"></LinearLayout>
</HorizontalScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:background="#bcbcbc"></TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="2">
<TextView
android:id="#+id/price_full_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/price_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="#000"
android:textSize="12sp" />
</LinearLayout>
<fone.adipoli.shopping.Rounded_textview
android:id="#+id/circle_txt"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginRight="70dp"
android:gravity="center"
android:padding="3dp"
android:text="" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#bcbcbc"></TextView>
<TextView
android:id="#+id/stock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:text="Check Availability"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/item_available_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3">
<EditText
android:id="#+id/enterpin"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="2"
android:background="#drawable/edittext_border"
android:cursorVisible="false"
android:hint="Enter Pincode"
android:inputType="number"
android:padding="5dp" />
<Button
android:id="#+id/pincheck"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center|right"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#000"
android:text="Check"
android:textColor="#color/white" />
</LinearLayout>
<RelativeLayout
android:id="#+id/chnge_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/item_available"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="14dp" />
<TextView
android:id="#+id/change_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="50dp"
android:text="Change\nPincode"
android:textColor="#color/blue"
android:textSize="14dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="Description :\n"
android:textColor="#000"
android:textSize="18dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/des_rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:orientation="vertical">
<WebView
android:id="#+id/text_des"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Full details"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/addtocart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Add to Cart"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:layout_width="2dp"
android:layout_height="wrap_content"></TextView>
<Button
android:id="#+id/buynow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Buy Now "
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
use it:
<?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:orientation="vertical">
<LinearLayout
android:id="#+id/ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<View
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_marginTop="0dp"
android:background="#drawable/toolbar_dropshadow" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#fff"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical" >
<TextView
android:id="#+id/text_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<ImageView
android:id="#+id/image_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="20dp"
android:scaleType="fitXY" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:scrollbars="none">
<LinearLayout
android:id="#+id/imageall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"></LinearLayout>
</HorizontalScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:background="#bcbcbc"></TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="2">
<TextView
android:id="#+id/price_full_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/price_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="#000"
android:textSize="12sp" />
</LinearLayout>
<fone.adipoli.shopping.Rounded_textview
android:id="#+id/circle_txt"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginRight="70dp"
android:gravity="center"
android:padding="3dp"
android:text="" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#bcbcbc"></TextView>
<TextView
android:id="#+id/stock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:text="Check Availability"
android:textAppearance="? android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/item_available_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3">
<EditText
android:id="#+id/enterpin"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="2"
android:background="#drawable/edittext_border"
android:cursorVisible="false"
android:hint="Enter Pincode"
android:inputType="number"
android:padding="5dp" />
<Button
android:id="#+id/pincheck"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center|right"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#000"
android:text="Check"
android:textColor="#color/white" />
</LinearLayout>
<RelativeLayout
android:id="#+id/chnge_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/item_available"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="14dp" />
<TextView
android:id="#+id/change_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="50dp"
android:text="Change\nPincode"
android:textColor="#color/blue"
android:textSize="14dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="Description :\n"
android:textColor="#000"
android:textSize="18dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/des_rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:orientation="vertical">
<WebView
android:id="#+id/text_des"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Full details"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<RelativeLayout
android:id="#+id/bottom_bar"
android:layout_below:"#+id/ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/addtocart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Add to Cart"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:layout_width="2dp"
android:layout_height="wrap_content"></TextView>
<Button
android:id="#+id/buynow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Buy Now "
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
Remove XMLNS from your scrollView, Give an id to scroll view. Then add attribute android:layout_below to the next component which is coming after scroll view.
<?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:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<View
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_marginTop="0dp"
android:background="#drawable/toolbar_dropshadow" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#fff"
android:id="#+id/scrol_view"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical" >
<TextView
android:id="#+id/text_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<ImageView
android:id="#+id/image_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="20dp"
android:scaleType="fitXY" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:scrollbars="none">
<LinearLayout
android:id="#+id/imageall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"></LinearLayout>
</HorizontalScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:background="#bcbcbc"></TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="2">
<TextView
android:id="#+id/price_full_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price"
android:textAppearance="? android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/price_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="#000"
android:textSize="12sp" />
</LinearLayout>
<fone.adipoli.shopping.Rounded_textview
android:id="#+id/circle_txt"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginRight="70dp"
android:gravity="center"
android:padding="3dp"
android:text="" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#bcbcbc"></TextView>
<TextView
android:id="#+id/stock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:text="Check Availability"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/item_available_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3">
<EditText
android:id="#+id/enterpin"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="2"
android:background="#drawable/edittext_border"
android:cursorVisible="false"
android:hint="Enter Pincode"
android:inputType="number"
android:padding="5dp" />
<Button
android:id="#+id/pincheck"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center|right"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#000"
android:text="Check"
android:textColor="#color/white" />
</LinearLayout>
<RelativeLayout
android:id="#+id/chnge_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/item_available"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="14dp" />
<TextView
android:id="#+id/change_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="50dp"
android:text="Change\nPincode"
android:textColor="#color/blue"
android:textSize="14dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="Description :\n"
android:textColor="#000"
android:textSize="18dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/des_rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:orientation="vertical">
<WebView
android:id="#+id/text_des"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Full details"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<RelativeLayout
android:id="#+id/bottom_bar"
android:layout_below="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/addtocart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Add to Cart"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:layout_width="2dp"
android:layout_height="wrap_content"></TextView>
<Button
android:id="#+id/buynow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Buy Now "
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>

How to add a layout multiple times in parent layout onClick of another layout?

I have a parent layout in which I want to add a child layout onClick of another layout. The layout I want to add it's visibility is gone right now. After clicking on NextDestination layout it shows the another layout which is LinearAddedDestination. I want to add this layout when the user clicks on NextDestination layout till 14 times after 14 times the NextDestination layout should not be visible.
How can I achieve this??
GoBoxActivity Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1.00"
android:background="#android:color/white"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="DESTINATION"
android:id="#+id/textView14"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="40dp"
android:orientation="horizontal"
android:background="#drawable/shape"
android:gravity="right"
android:layout_gravity="center|right"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="100dp"
android:id="#+id/LinearRemove"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_clear_black_18dp"
android:layout_marginLeft="05dp"
android:layout_marginTop="05dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="REMOVE"
android:id="#+id/textView47"
android:layout_gravity="center"
android:layout_marginLeft="05dp"
android:textSize="14sp"
android:layout_marginRight="15dp" />
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="08dp"
android:id="#+id/imageView14"
android:background="#drawable/line2"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView10"
android:layout_marginStart="20dp"
android:background="#drawable/ic_place_black_48dp"
android:layout_marginTop="05dp"
android:layout_gravity="center" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/Text_to"
android:drawableEnd="#drawable/ic_chevron_right_black_24dp"
android:layout_marginEnd="10dp"
android:text="#string/Loc"
android:layout_gravity="center"
android:layout_marginTop="05dp"
android:textAppearance="#android:style/TextAppearance.Medium"
android:cursorVisible="false"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Street/Building/Place"
android:layout_marginStart="48dp"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView17"
android:layout_marginStart="20dp"
android:background="#drawable/ic_description_black_48dp"
android:layout_marginTop="10dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="#+id/editText_to_details"
android:layout_marginEnd="10dp"
android:hint="#string/LocationDetails"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/textViewHouseDetailsTo"
android:layout_marginStart="48dp"
android:hint="#string/HouseDetails" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:id="#+id/LinearLayoutAdditionalContactTo">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView18"
android:layout_marginStart="20dp"
android:background="#drawable/ic_person_black_48dp"
android:layout_marginTop="05dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/contactDetailsTo"
android:layout_marginEnd="10dp"
android:text="#string/additionalContact"
android:textAppearance="?android:attr/textAppearanceMedium"
android:drawableEnd="#drawable/ic_expand_more_black_24dp"
android:layout_marginTop="08dp"
android:layout_marginStart="05dp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_marginEnd="50dp"
android:layout_gravity="center"
android:visibility="gone"
android:id="#+id/LinearLayoutTo"
android:layout_marginTop="20dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTex"
android:layout_weight="1"
android:hint="Name"
android:layout_gravity="center"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTe"
android:layout_weight="1"
android:hint="Phone"
android:layout_gravity="center"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="#string/or"
android:id="#+id/textViewInputIfSender"
android:layout_gravity="center"
android:layout_marginTop="20dp" />
<LinearLayout
android:layout_width="220dp"
android:layout_height="40dp"
android:background="#drawable/shape"
android:layout_gravity="center_horizontal">
<ImageButton
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageButton1"
android:background="#drawable/phone2"
android:layout_gravity="center"
android:layout_marginStart="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="#string/addFromContacts"
android:id="#+id/textView35"
android:layout_gravity="center"
android:layout_marginStart="20dp" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/textViewInputReceiver"
android:layout_marginLeft="48dp"
android:hint="#string/contact1"
android:layout_marginTop="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:focusable="true"
android:focusableInTouchMode="true">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView12"
android:layout_marginStart="20dp"
android:background="#drawable/ic_description_black_48dp"
android:layout_marginTop="10dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="#+id/editText_from_details"
android:layout_marginEnd="10dp"
android:hint="Instruction"
android:layout_gravity="center"
android:layout_marginLeft="10dp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1.00"
android:background="#android:color/white"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:id="#+id/LinearAddedDestination"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="DESTINATION"
android:id="#+id/textView14"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="40dp"
android:orientation="horizontal"
android:background="#drawable/shape"
android:gravity="right"
android:layout_gravity="center|right"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="80dp"
android:id="#+id/LinearRemove">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_clear_black_18dp"
android:layout_marginLeft="05dp"
android:layout_marginTop="05dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="REMOVE"
android:id="#+id/textView47"
android:layout_gravity="center"
android:layout_marginLeft="05dp"
android:textSize="14sp"
android:layout_marginRight="15dp" />
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="08dp"
android:id="#+id/imageView14"
android:background="#drawable/line2"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView10"
android:layout_marginStart="20dp"
android:background="#drawable/ic_place_black_48dp"
android:layout_marginTop="05dp"
android:layout_gravity="center" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/Text_to"
android:drawableEnd="#drawable/ic_chevron_right_black_24dp"
android:layout_marginEnd="10dp"
android:text="#string/Loc"
android:layout_gravity="center"
android:layout_marginTop="05dp"
android:textAppearance="#android:style/TextAppearance.Medium"
android:cursorVisible="false"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Street/Building/Place"
android:layout_marginStart="48dp"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView17"
android:layout_marginStart="20dp"
android:background="#drawable/ic_description_black_48dp"
android:layout_marginTop="10dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="#+id/editText_to_details"
android:layout_marginEnd="10dp"
android:hint="#string/LocationDetails"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/textViewHouseDetailsTo"
android:layout_marginStart="48dp"
android:hint="#string/HouseDetails" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:id="#+id/LinearLayoutAdditionalContactTo">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView18"
android:layout_marginStart="20dp"
android:background="#drawable/ic_person_black_48dp"
android:layout_marginTop="05dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/contactDetailsTo"
android:layout_marginEnd="10dp"
android:text="#string/additionalContact"
android:textAppearance="?android:attr/textAppearanceMedium"
android:drawableEnd="#drawable/ic_expand_more_black_24dp"
android:layout_marginTop="08dp"
android:layout_marginStart="05dp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_marginEnd="50dp"
android:layout_gravity="center"
android:visibility="gone"
android:id="#+id/LinearLayoutTo"
android:layout_marginTop="20dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTex"
android:layout_weight="1"
android:hint="Name"
android:layout_gravity="center"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTe"
android:layout_weight="1"
android:hint="Phone"
android:layout_gravity="center"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="#string/or"
android:id="#+id/textViewInputIfSender"
android:layout_gravity="center"
android:layout_marginTop="20dp" />
<LinearLayout
android:layout_width="220dp"
android:layout_height="40dp"
android:background="#drawable/shape"
android:layout_gravity="center_horizontal">
<ImageButton
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageButton1"
android:background="#drawable/phone2"
android:layout_gravity="center"
android:layout_marginStart="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="#string/addFromContacts"
android:id="#+id/textView35"
android:layout_gravity="center"
android:layout_marginStart="20dp" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/textViewInputReceiver"
android:layout_marginLeft="48dp"
android:hint="#string/contact1"
android:layout_marginTop="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:focusable="true"
android:focusableInTouchMode="true">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView12"
android:layout_marginStart="20dp"
android:background="#drawable/ic_description_black_48dp"
android:layout_marginTop="10dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="#+id/editText_from_details"
android:layout_marginEnd="10dp"
android:hint="Instruction"
android:layout_gravity="center"
android:layout_marginLeft="10dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="40dp"
android:orientation="horizontal"
android:background="#drawable/shape"
android:layout_gravity="right"
android:layout_marginEnd="15dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:id="#+id/LinearNextDestination">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_add_black_18dp"
android:layout_marginLeft="05dp"
android:layout_marginTop="05dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="NEXT DESTINATION"
android:id="#+id/textView47"
android:layout_gravity="center"
android:layout_marginLeft="05dp"
android:textSize="14sp"
android:layout_marginRight="15dp" />
</LinearLayout>
</LinearLayout>
You are having many layout as the child layout for the main layout. But the better way to achieve your goal is to add fragment.
Using the fragment you can easily change the layouts view. Look at these links. Adding fragment will solve your problem.
http://developer.android.com/training/basics/fragments/creating.html
http://examples.javacodegeeks.com/android/core/app/fragment/android-fragments-example/
http://www.vogella.com/tutorials/AndroidFragments/article.html
http://www.learn2crack.com/2014/05/android-working-with-fragments.html
Using the fragment you can divide the space in the layout and add multiple fragments inside that.

Button not widening

I cannot widen buttons on my Android project. I'm only having an issue with one of them.
This is what I'm getting
And this is what I want
Only the buttons. Here is my XML for the corresponding issue.
<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:background="#4ECDC4"
tools:context=".MainActivity" >
<RelativeLayout
android:id="#+id/rlSignInForm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rlSignInTitle"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="36dp" >
<LinearLayout
android:id="#+id/llSignInBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#FFFFFF"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:visibility="visible"
android:weightSum="2" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivEmailIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/email_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignInEmail"
android:layout_marginBottom="2dp"/>
<EditText
android:id="#+id/etSignInEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#null"
android:layout_toRightOf="#+id/ivEmailIcon"
android:layout_marginLeft="10dp"
android:gravity="bottom"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#drawable/sign_in_divider" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivPasswordIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/password_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignInPassword"
android:layout_marginBottom="3dp"/>
<EditText
android:id="#+id/etSignInPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#null"
android:layout_toRightOf="#+id/ivPasswordIcon"
android:layout_marginLeft="10dp"
android:gravity="bottom"
android:hint="#string/password"
android:inputType="textPassword"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/llSignUpBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#FFFFFF"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:visibility="visible"
android:weightSum="3" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivUserNameIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/username_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignUpName"/>
<EditText
android:id="#+id/etSignUpName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/ivUserNameIcon"
android:background="#null"
android:gravity="bottom"
android:hint="#string/username"
android:singleLine="true"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#drawable/sign_in_divider" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivEmailIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/email_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignUpEmail"
android:layout_marginBottom="2dp"/>
<EditText
android:id="#+id/etSignUpEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/ivEmailIcon"
android:background="#null"
android:gravity="bottom"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#drawable/sign_in_divider" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivPasswordIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/password_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignUpPassword"
android:layout_marginBottom="3dp"/>
<EditText
android:id="#+id/etSignUpPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/ivPasswordIcon"
android:background="#null"
android:gravity="bottom"
android:hint="#string/password"
android:inputType="textPassword"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/llForgotPasswordBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#FFFFFF"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:weightSum="2"
android:visibility="gone" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivEmailIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/email_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etForgotPasswordEmail"
android:layout_marginBottom="2dp"/>
<EditText
android:id="#+id/etForgotPasswordEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#null"
android:layout_toRightOf="#+id/ivEmailIcon"
android:layout_marginLeft="10dp"
android:gravity="bottom"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<Button
android:id="#+id/btnForgotPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/rlSignInForm"
android:layout_below="#+id/rlSignInForm"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#null"
android:text="#string/forgot_password"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<Button
android:id="#+id/btnSendPassword"
android:layout_width="175dp"
android:layout_height="55dp"
android:layout_below="#+id/rlSignInTitle"
android:layout_centerHorizontal="true"
android:layout_marginTop="180dp"
android:background="#drawable/rounded_rect_positive_selector"
android:gravity="center"
android:text="#string/SEND_PASSWORD"
android:textColor="#android:color/white"
android:textStyle="bold"
android:width="175dp"
android:height="55dp"
android:visibility="gone" />
<Button
android:id="#+id/btnActive"
android:layout_width="175dp"
android:layout_height="55dp"
android:layout_alignLeft="#+id/btnInactive"
android:layout_alignRight="#+id/rlSignInForm"
android:layout_below="#+id/rlSignInTitle"
android:layout_marginTop="280dp"
android:background="#AD5BDB"
android:gravity="center"
android:text="#string/SIGN_IN"
android:textColor="#android:color/white"
android:textSize="22sp"
android:textStyle="bold"
android:visibility="visible" />
<Button
android:id="#+id/btnInactive"
style="#style/AppTheme"
android:layout_width="175dp"
android:layout_height="55dp"
android:layout_alignLeft="#+id/rlSignInForm"
android:layout_alignRight="#+id/rlSignInForm"
android:layout_below="#+id/btnActive"
android:layout_marginTop="14dp"
android:background="#AD58DB"
android:gravity="center"
android:text="#string/SIGN_UP"
android:textColor="#android:color/white"
android:textSize="22sp"
android:textStyle="bold"
android:visibility="visible" />
<RelativeLayout
android:id="#+id/rlNoInternetNotification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/rlSignInTitle"
android:visibility="gone" >
<include layout="#layout/no_internet_notification" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlPushNotification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/rlSignInTitle"
android:visibility="gone" >
<include layout="#layout/push_notification" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlSignInTitle"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="30dp"
android:background="#4ECDC4" >
<com.cloverstudio.spika.view.MyriadProTextView
android:id="#+id/tvSignInTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="#string/SIGN_IN"
android:textColor="#android:color/white"
android:textSize="26sp" />
</RelativeLayout>
</RelativeLayout>
The smaller button is btnSendPassword and the other button is btnActive. I've tried playing with the widths but nothing changed. I'm fairly new so any explaination why this is happening would be good, so then I know whats wrong if it happens again.Any help would be wonderful.
You should align your btnSendPassword button with rlSignInForm for both left and right...then you will achieve your requirement. Replace the following XML snippet of btnSendPassword with your existing XML snippet of btnSendPassword...you will get all the problem solved.
<Button
android:id="#+id/btnSendPassword"
android:layout_width="175dp"
android:layout_height="55dp"
android:layout_below="#+id/rlSignInTitle"
android:layout_alignLeft="#+id/rlSignInForm"
android:layout_alignRight="#+id/rlSignInForm"
android:layout_marginTop="180dp"
android:background="#drawable/rounded_rect_positive_selector"
android:gravity="center"
android:text="#string/SEND_PASSWORD"
android:textColor="#android:color/white"
android:textStyle="bold"
android:visibility="gone" />
Set android:layout_width="match_parent". This should solve your problem.

Categories

Resources