This is my xml layout. It is not displaying the views that are placed below recyclerview while running the app. I dont know why. None of the solutions I have found online have solved my issue. Will layout_weight or layout_below solve the problem?
Somewhere I found that:
If your recycleview content will extend beyond the display height then you should consider dividing your layout into partitions with android:layout_weight.
Can anyone please help me:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/viewBg"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:showIn="#layout/activity_home_screen">
<LinearLayout
android:id="#+id/section_home_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="horizontal">
<EditText
android:id="#+id/search_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_toLeftOf="#+id/search_btn"
android:layout_toStartOf="#+id/search_btn"
android:layout_weight="1"
android:background="#drawable/search_layout"
android:ems="10"
android:hint="Search here"
android:inputType="textPersonName"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
android:textColor="#999999"
android:textSize="16sp" />
<ImageButton
android:id="#+id/search_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/search_field"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/search_field"
android:layout_gravity="center_vertical"
android:background="#android:color/background_light"
app:srcCompat="#drawable/search_button"
android:layout_alignParentRight="true" />
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_recentsearchlist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:orientation="vertical"
android:layout_below="#+id/section_home_search"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="1dp"
android:paddingBottom="4dp"
android:text="Recently searched gyms"
android:textColor="#color/light_black"
android:textSize="14dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview_gymsrecent_home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/section_home_recentsearchlist"
android:clipToPadding="false"
android:scrollbars="vertical" />
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_offers"
android:layout_below="#id/section_home_recentsearchlist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="1dp"
android:paddingBottom="4dp"
android:text="Latest Offers"
android:textColor="#color/light_black"
android:textSize="14dp"/>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Fitness Plus"
android:textColor="#color/white"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="Choice of Gym Trial Classes and More at Rs.149 only !\nEarn Upto 8.5% Cashback"
android:textColor="#color/white"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#color/darkorange"
android:padding="8dp"
android:text=" Learn More "
android:textColor="#color/white"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Health Total"
android:textColor="#color/white"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="1-Month Health Plan for Lifestyle Ailments. "
android:textColor="#color/white"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#color/darkorange"
android:padding="8dp"
android:text=" Learn More "
android:textColor="#color/white"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Gym 'N' Swim"
android:textColor="#color/white"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="Swimming Pool & Gym Memberships at Rs.5000 only. "
android:textColor="#color/white"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#color/darkorange"
android:padding="8dp"
android:text=" Learn More "
android:textColor="#color/white"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_trainerfb"
android:layout_below="#id/section_home_offers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp"
android:paddingBottom="4dp"
android:text="Trainer's Feedback"
android:textColor="#color/light_black"
android:textSize="14dp"/>
</LinearLayout>
</RelativeLayout>
set fix height of the recycleview or set parent layout as linearlayout and set weight of all layouts like this:
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview_gymsrecent_home"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_below="#id/section_home_recentsearchlist"
android:clipToPadding="false"
android:scrollbars="vertical" />
or
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview_gymsrecent_home"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="#id/section_home_recentsearchlist"
android:clipToPadding="false"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical" />
Use android:layout_weight properly. try with this.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/section_home_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="10dp">
<EditText
android:id="#+id/search_field"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Search here"
android:inputType="textPersonName"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
android:textColor="#999999"
android:textSize="16sp" />
<ImageButton
android:id="#+id/search_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_recentsearchlist"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:padding="2dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="1dp"
android:text="Recently searched gyms"
android:textSize="14dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview_gymsrecent_home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:scrollbars="vertical" />
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_offers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="2dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="1dp"
android:text="Latest Offers"
android:textSize="14dp" />
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Fitness Plus"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="Choice of Gym Trial Classes and More at Rs.149 only !\nEarn Upto 8.5% Cashback"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:padding="8dp"
android:text=" Learn More "
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Health Total"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="1-Month Health Plan for Lifestyle Ailments. "
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:padding="8dp"
android:text=" Learn More "
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Gym 'N' Swim"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="Swimming Pool & Gym Memberships at Rs.5000 only. "
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:padding="8dp"
android:text=" Learn More "
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_trainerfb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="2dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp"
android:text="Trainer's Feedback"
android:textSize="14dp" />
</LinearLayout>
</LinearLayout>
Try with 'trainerfb' align to parent bottom, 'home_offers' above 'trainerfb' and 'recentsearchlist' fill up all the space in the middle of the display.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/viewBg"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:showIn="#layout/activity_home_screen">
<LinearLayout
android:id="#+id/section_home_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="horizontal">
<EditText
android:id="#+id/search_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_toLeftOf="#+id/search_btn"
android:layout_toStartOf="#+id/search_btn"
android:layout_weight="1"
android:background="#drawable/search_layout"
android:ems="10"
android:hint="Search here"
android:inputType="textPersonName"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
android:textColor="#999999"
android:textSize="16sp" />
<ImageButton
android:id="#+id/search_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/search_field"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/search_field"
android:layout_gravity="center_vertical"
android:background="#android:color/background_light"
app:srcCompat="#drawable/search_button"
android:layout_alignParentRight="true" />
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_recentsearchlist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="2dp"
android:orientation="vertical"
android:layout_below="#+id/section_home_search"
android:layout_above="#id/section_home_offers"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="1dp"
android:paddingBottom="4dp"
android:text="Recently searched gyms"
android:textColor="#color/light_black"
android:textSize="14dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview_gymsrecent_home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/section_home_recentsearchlist"
android:clipToPadding="false"
android:scrollbars="vertical" />
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_offers"
android:layout_above="#id/section_home_trainerfb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="1dp"
android:paddingBottom="4dp"
android:text="Latest Offers"
android:textColor="#color/light_black"
android:textSize="14dp"/>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Fitness Plus"
android:textColor="#color/white"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="Choice of Gym Trial Classes and More at Rs.149 only !\nEarn Upto 8.5% Cashback"
android:textColor="#color/white"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#color/darkorange"
android:padding="8dp"
android:text=" Learn More "
android:textColor="#color/white"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Health Total"
android:textColor="#color/white"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="1-Month Health Plan for Lifestyle Ailments. "
android:textColor="#color/white"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#color/darkorange"
android:padding="8dp"
android:text=" Learn More "
android:textColor="#color/white"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Gym 'N' Swim"
android:textColor="#color/white"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="Swimming Pool & Gym Memberships at Rs.5000 only. "
android:textColor="#color/white"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#color/darkorange"
android:padding="8dp"
android:text=" Learn More "
android:textColor="#color/white"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_trainerfb"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp"
android:paddingBottom="4dp"
android:text="Trainer's Feedback"
android:textColor="#color/light_black"
android:textSize="14dp"/>
</LinearLayout>
Related
I'm using Linear Layout as Parent layout and need a linear layout in the bottom of the page that i'll be using as a button.
All that i can use now is margin top to that linear layout which won't be the proper method. So i need help in implementing the layout to the bottom of the screen.
Or any recommendation of which layout that i need to use for the desired results.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#F0F0F0">
<LinearLayout
android:layout_margin="10dp"
android:background="#FFFFFF"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_margin="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:textColor="#000000"
android:text="Customer contact details:"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TableRow
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:weightSum="2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textColor="#000000"
android:layout_weight="1"
android:text="Name:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_weight="1"
android:text="User Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<TableRow
android:layout_marginBottom="5dp"
android:weightSum="2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textColor="#000000"
android:layout_weight="1"
android:text="Email:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_weight="1"
android:text="user#gmail.com"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<TableRow
android:weightSum="2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textColor="#000000"
android:layout_weight="1"
android:text="Mobile:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_weight="1"
android:text="123456"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>
<TextView
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="DELIVERY TYPE"
android:textColor="#000000"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:layout_marginTop="10dp"
android:id="#+id/text"
android:layout_marginStart="20dp"
android:paddingEnd="10dp"
android:text="Note: Delivery fee will be added based on the delivery
address."
android:textColor="#000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_marginTop="10dp"
android:paddingTop="5dp"
android:background="#FFFFFF"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:text="Pickup"
android:textColor="#000000"
android:layout_marginStart="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/pickup_time"
android:text="Select pickup time"
android:textSize="12sp"
android:layout_marginBottom="5dp"
android:layout_marginStart="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:background="#D3D3D3"
android:layout_width="match_parent"
android:layout_height="1dp"/>
<TextView
android:text="Delivery"
android:layout_marginTop="5dp"
android:layout_marginStart="20dp"
android:textColor="#000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/delivery_time"
android:text="Select delivery time"
android:textSize="12sp"
android:layout_marginBottom="5dp"
android:layout_marginStart="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<TextView
android:textColor="#000000"
android:layout_marginTop="10dp"
android:layout_marginStart="20dp"
android:id="#+id/payment_option"
android:text="PAYMENT OPTION"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_marginTop="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:background="#FFFFFF"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:layout_marginStart="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:text="Pay Online"
android:layout_marginStart="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:weightSum="1"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_weight="1"
android:text="DELIVERY ADDRESS"
android:textColor="#000000"
android:layout_marginStart="20dp"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<Button
android:layout_marginEnd="10dp"
android:padding="10dp"
android:id="#+id/add_address"
android:text="Add Address"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:background="#drawable/button_red"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_marginTop="5dp"
android:background="#FFFFFF"
android:layout_width="match_parent"
android:layout_height="2dp"/>
<TextView
android:text="Home"
android:textColor="#000000"
android:layout_marginStart="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:textColor="#000000"
android:layout_marginStart="30dp"
android:text="User Address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:padding="10dp"
android:weightSum="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#E22028">
<TextView
android:layout_weight="1"
android:gravity="center_horizontal"
android:textColor="#FFFFFF"
android:text="Continue"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<ImageView
android:src="#drawable/ic_navigate_next_black_24dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
for such complex view you should always go for constraint layout . They are really handy .
There are few things which you need to take care of , as from your code i can see lots of hard coded text and dimens , which turns out to be bad practice for any android developer . And even the naming conventions should be take a look on .
Here the guideline for naming convention we should follow for a long run in android .
https://github.com/ribot/android-guidelines/blob/master/project_and_code_guidelines.md
And for the constraint layout , you can use the below link to get better understanding.
https://android-developers.googleblog.com/2017/08/understanding-performance-benefits-of.html
https://blog.mindorks.com/android-constraint-layout
Always try to put your dimes in dimes.xml folder under res . Res < values < dimens.
Now coming to your questions , we can do this with constraint layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/constraint_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F0F0F0"
android:orientation="vertical">
<LinearLayout
android:id="#+id/linear_customer_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:orientation="vertical"
android:padding="10dp"
app:layout_constraintEnd_toEndOf="#id/constraint_parent"
app:layout_constraintStart_toStartOf="#id/constraint_parent"
app:layout_constraintTop_toTopOf="#id/constraint_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Customer contact details:"
android:textColor="#000000" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:weightSum="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Name:"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="User Name" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:weightSum="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Email:"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="user#gmail.com" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Mobile:"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="123456" />
</TableRow>
</TableLayout>
</LinearLayout>
<TextView
android:id="#+id/text_delivery_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:text="DELIVERY TYPE"
android:textColor="#000000"
app:layout_constraintEnd_toEndOf="#id/constraint_parent"
app:layout_constraintStart_toStartOf="#id/constraint_parent"
app:layout_constraintTop_toBottomOf="#+id/linear_customer_detail" />
<TextView
android:id="#+id/text_delivery_note"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingEnd="10dp"
android:text="Note: Delivery fee will be added based on the delivery
address."
android:textColor="#000000"
app:layout_constraintEnd_toEndOf="#id/text_delivery_type"
app:layout_constraintStart_toStartOf="#+id/text_delivery_type"
app:layout_constraintTop_toBottomOf="#+id/text_delivery_type" />
<LinearLayout
android:id="#+id/linear_pickup_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#FFFFFF"
android:orientation="vertical"
android:paddingTop="5dp"
app:layout_constraintEnd_toEndOf="#id/constraint_parent"
app:layout_constraintStart_toStartOf="#id/constraint_parent"
app:layout_constraintTop_toBottomOf="#+id/text_delivery_note">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="Pickup"
android:textColor="#000000" />
<TextView
android:id="#+id/pickup_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginBottom="5dp"
android:text="Select pickup time"
android:textSize="12sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#D3D3D3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:text="Delivery"
android:textColor="#000000" />
<TextView
android:id="#+id/delivery_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginBottom="5dp"
android:text="Select delivery time"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="#+id/payment_option"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="PAYMENT OPTION"
android:textColor="#000000"
app:layout_constraintEnd_toEndOf="#id/text_delivery_type"
app:layout_constraintStart_toStartOf="#id/text_delivery_type"
app:layout_constraintTop_toBottomOf="#+id/linear_pickup_view" />
<LinearLayout
android:id="#+id/linear_pay_online"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#FFFFFF"
android:paddingTop="5dp"
android:paddingBottom="5dp"
app:layout_constraintEnd_toEndOf="#id/constraint_parent"
app:layout_constraintStart_toStartOf="#id/constraint_parent"
app:layout_constraintTop_toBottomOf="#+id/payment_option">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="Pay Online" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:text="DELIVERY ADDRESS"
android:textColor="#000000"
app:layout_constraintBottom_toBottomOf="#id/add_address"
app:layout_constraintStart_toStartOf="#id/text_delivery_type"
app:layout_constraintTop_toTopOf="#id/add_address" />
<Button
android:id="#+id/add_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="#drawable/button_red"
android:padding="10dp"
android:text="Add Address"
android:textAllCaps="false"
android:textColor="#FFFFFF"
app:layout_constraintEnd_toEndOf="#id/text_delivery_type"
app:layout_constraintTop_toBottomOf="#+id/linear_pay_online" />
<View
android:id="#+id/view_divider"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="5dp"
android:background="#FFFFFF"
app:layout_constraintEnd_toEndOf="#id/constraint_parent"
app:layout_constraintStart_toStartOf="#id/constraint_parent"
app:layout_constraintTop_toBottomOf="#id/add_address" />
<TextView
android:id="#+id/text_home"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Home"
android:textColor="#000000"
app:layout_constraintEnd_toEndOf="#id/text_delivery_type"
app:layout_constraintStart_toStartOf="#id/text_delivery_type"
app:layout_constraintTop_toBottomOf="#id/view_divider" />
<TextView
android:id="#+id/text_user_address"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="User Address"
android:textColor="#000000"
app:layout_constraintEnd_toEndOf="#id/text_home"
app:layout_constraintStart_toStartOf="#id/text_home"
app:layout_constraintTop_toBottomOf="#+id/text_home" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#E22028"
android:padding="10dp"
android:weightSum="1"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="Continue"
android:textColor="#FFFFFF" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_navigate_next_black_24dp" />
</LinearLayout>
Hope this will be helpful . Happy coding .
You can use a Spacer view inside your LinearLayout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#F0F0F0">
<!-- Top View -->
<View
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!-- Vertical Spacer -->
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<!-- Bottom View -->
<View
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
The vertical spacer will fill the screen between your top and bottom views.
try this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F0F0F0">
<!-- You can also use a button with 'android:drawableEnd="#drawable/ic_navigate_next_black_24dp" -->
<!-- instead of this LinearLayout'-->
<LinearLayout
android:id="#+id/layout_bottom_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#E22028"
android:gravity="center"
android:padding="10dp"
android:weightSum="1">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="Continue"
android:textColor="#FFFFFF" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_navigate_next_black_24dp" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#id/layout_bottom_btn"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#F0F0F0"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#FFFFFF"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Customer contact details:"
android:textColor="#000000" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:weightSum="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Name:"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="User Name" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:weightSum="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Email:"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="user#gmail.com" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Mobile:"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="123456" />
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="DELIVERY TYPE"
android:textColor="#000000" />
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:paddingEnd="10dp"
android:text="Note: Delivery fee will be added based on the deliveryaddress."
android:textColor="#000000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#FFFFFF"
android:orientation="vertical"
android:paddingTop="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="Pickup"
android:textColor="#000000" />
<TextView
android:id="#+id/pickup_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginBottom="5dp"
android:text="Select pickup time"
android:textSize="12sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#D3D3D3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:text="Delivery"
android:textColor="#000000" />
<TextView
android:id="#+id/delivery_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginBottom="5dp"
android:text="Select delivery time"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="#+id/payment_option"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="PAYMENT OPTION"
android:textColor="#000000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#FFFFFF"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="Pay Online" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_weight="1"
android:text="DELIVERY ADDRESS"
android:textColor="#000000" />
<Button
android:id="#+id/add_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="#drawable/button_red"
android:padding="10dp"
android:text="Add Address"
android:textAllCaps="false"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="5dp"
android:background="#FFFFFF" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:text="Home"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:text="User Address"
android:textColor="#000000" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
I used RelativeLayout as parent in your layout and as Tim Castelijns commented, yes you have to use ConstraintLayout for better and responsive user interface.
your layout has toomany hierarchy element , use constraint layout instead, however in LinearLayout you can add view with weight 1 and height 0 like i added in your layout
**<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#F0F0F0">
<LinearLayout
android:layout_margin="10dp"
android:background="#FFFFFF"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_margin="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:textColor="#000000"
android:text="Customer contact details:"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TableRow
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:weightSum="2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textColor="#000000"
android:layout_weight="1"
android:text="Name:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_weight="1"
android:text="User Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<TableRow
android:layout_marginBottom="5dp"
android:weightSum="2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textColor="#000000"
android:layout_weight="1"
android:text="Email:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_weight="1"
android:text="user#gmail.com"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
<TableRow
android:weightSum="2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textColor="#000000"
android:layout_weight="1"
android:text="Mobile:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_weight="1"
android:text="123456"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>
<TextView
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="DELIVERY TYPE"
android:textColor="#000000"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:layout_marginTop="10dp"
android:id="#+id/text"
android:layout_marginStart="20dp"
android:paddingEnd="10dp"
android:text="Note: Delivery fee will be added based on the delivery
address."
android:textColor="#000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_marginTop="10dp"
android:paddingTop="5dp"
android:background="#FFFFFF"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:text="Pickup"
android:textColor="#000000"
android:layout_marginStart="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/pickup_time"
android:text="Select pickup time"
android:textSize="12sp"
android:layout_marginBottom="5dp"
android:layout_marginStart="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:background="#D3D3D3"
android:layout_width="match_parent"
android:layout_height="1dp"/>
<TextView
android:text="Delivery"
android:layout_marginTop="5dp"
android:layout_marginStart="20dp"
android:textColor="#000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/delivery_time"
android:text="Select delivery time"
android:textSize="12sp"
android:layout_marginBottom="5dp"
android:layout_marginStart="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<TextView
android:textColor="#000000"
android:layout_marginTop="10dp"
android:layout_marginStart="20dp"
android:id="#+id/payment_option"
android:text="PAYMENT OPTION"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_marginTop="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:background="#FFFFFF"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:layout_marginStart="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:text="Pay Online"
android:layout_marginStart="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:weightSum="1"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_weight="1"
android:text="DELIVERY ADDRESS"
android:textColor="#000000"
android:layout_marginStart="20dp"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<Button
android:layout_marginEnd="10dp"
android:padding="10dp"
android:id="#+id/add_address"
android:text="Add Address"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:background="#drawable/button_red"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_marginTop="5dp"
android:background="#FFFFFF"
android:layout_width="match_parent"
android:layout_height="2dp"/>
<TextView
android:text="Home"
android:textColor="#000000"
android:layout_marginStart="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:textColor="#000000"
android:layout_marginStart="30dp"
android:text="User Address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<LinearLayout
android:padding="10dp"
android:weightSum="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#E22028">
<TextView
android:layout_weight="1"
android:gravity="center_horizontal"
android:textColor="#FFFFFF"
android:text="Continue"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<ImageView
android:src="#drawable/ic_navigate_next_black_24dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>**
replace LinearLayout with relative layout and create sub-parent linear layout and put your views inside it and then make it alignparent bottom make sure you have gave sub-parent layout height to wrap content
<RelativeLayout 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_gravity="bottom"
android:layout_alignParentBottom="true"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--put your layout inside it-->
</LinearLayout>
i am trying to make application can scrolled vertically, and inside my NestedScrollView and want put HorizontalView to scroll horizontal some of my TableLayout, Scrollview is working perfectly but the Horizontal Can't Scroll. How can i solve this? Thanks for your help.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#383735"
android:baselineAligned="false">
<android.support.v4.widget.NestedScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/vertical">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp">
<TextView
android:layout_width="130dp"
android:layout_height="wrap_content"
android:id="#+id/koded"
android:textColor="#ffffff"
android:text="Kode: "
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/koded"
android:textColor="#ffffff"
android:id="#+id/isikoded"/>
<TextView
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_below="#id/isikoded"
android:id="#+id/tglaju"
android:textColor="#ffffff"
android:text="Tgl Input: "
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/tglaju"
android:layout_below="#+id/isikoded"
android:id="#+id/isitglaju"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_below="#id/isitglaju"
android:id="#+id/jpegawai"
android:textColor="#ffffff"
android:text="Pegawai: "
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/jpegawai"
android:layout_below="#+id/isitglaju"
android:id="#+id/isipegawai"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_below="#id/isipegawai"
android:id="#+id/jdivisi"
android:textColor="#ffffff"
android:text="Divisi: "
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/jdivisi"
android:layout_below="#+id/isipegawai"
android:id="#+id/isidivisi"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_below="#id/isidivisi"
android:id="#+id/tglbth"
android:textColor="#ffffff"
android:text="Tgl Penawaran: "
android:layout_marginTop="10dp"
/>
<TextView android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/tglbth"
android:layout_below="#+id/isidivisi"
android:id="#+id/isitglbutuh"
android:textColor="#ffffff"/>
<TextView
android:layout_width="130dp"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:id="#+id/supd"
android:layout_marginTop="10dp"
android:text="No Penawaran: "
android:layout_below="#+id/tglbth"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/isitglbutuh"
android:layout_toRightOf="#id/supd"
android:id="#+id/isinomor"
android:textColor="#ffffff"
android:layout_marginTop="10dp"/>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/isinomor"
android:fillViewport="true"
android:scrollbars="horizontal"
android:nestedScrollingEnabled="false"
android:scrollbarAlwaysDrawHorizontalTrack="true"
android:id="#+id/horizontal">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/isinomor"
android:id="#+id/tablejdl"
android:weightSum="7"
android:layout_marginTop="20dp"
>
<TableRow
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:weightSum="7"
android:gravity="center_horizontal">
<TextView
android:textColor="#ffffff"
android:layout_marginTop="10dp"
android:layout_width="0dp"
android:textSize="11sp"
android:layout_height="wrap_content"
android:text="Barang"
android:layout_weight="2"
android:id="#+id/kodebar"
/>
<TextView
android:textColor="#ffffff"
android:layout_marginTop="10dp"
android:layout_width="0dp"
android:textSize="11sp"
android:layout_height="wrap_content"
android:text="Jumlah"
android:layout_weight="1"
android:id="#+id/jumlah"
/>
<TextView
android:textColor="#ffffff"
android:layout_marginTop="10dp"
android:layout_width="0dp"
android:textSize="11sp"
android:layout_height="wrap_content"
android:text="Sup1"
android:layout_weight="1"
android:id="#+id/namabar"/>
<TextView
android:textColor="#ffffff"
android:layout_marginTop="10dp"
android:layout_width="0dp"
android:textSize="11sp"
android:layout_height="wrap_content"
android:text="Sup2"
android:layout_weight="1"
android:id="#+id/jumlahbar"/>
<TextView
android:textColor="#ffffff"
android:layout_marginTop="10dp"
android:layout_width="0dp"
android:textSize="11sp"
android:layout_height="wrap_content"
android:text="Sup3"
android:layout_weight="1"
android:id="#+id/stokbar"/>
<TextView
android:textColor="#ffffff"
android:layout_marginTop="10dp"
android:layout_width="0dp"
android:textSize="11sp"
android:layout_height="wrap_content"
android:text="Total"
android:layout_weight="1"
android:id="#+id/jtotal"/>
</TableRow>
</TableLayout>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/tablejdl"
android:id="#+id/recyclerpenawaran">
</android.support.v7.widget.RecyclerView>
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/dddd"
android:id="#+id/tablejdl2"
android:weightSum="7"
android:layout_marginTop="15dp"
>
<TableRow
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:weightSum="7"
android:gravity="center_horizontal">
<TextView
android:textColor="#ffffff"
android:layout_marginTop="10dp"
android:layout_width="0dp"
android:textSize="11sp"
android:layout_height="wrap_content"
android:layout_weight="2"
/>
<TextView
android:textColor="#ffffff"
android:layout_marginTop="10dp"
android:layout_width="0dp"
android:textSize="11sp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<CheckBox
android:textColor="#ffffff"
android:layout_marginTop="10dp"
android:layout_width="0dp"
android:textSize="11sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="#+id/checksup1"/>
<CheckBox
android:textColor="#ffffff"
android:layout_marginTop="10dp"
android:layout_width="0dp"
android:textSize="11sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="#+id/checksup2"/>
<CheckBox
android:textColor="#ffffff"
android:layout_marginTop="10dp"
android:layout_width="0dp"
android:textSize="11sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="#+id/checksup3"/>
<TextView
android:textColor="#ffffff"
android:layout_marginTop="10dp"
android:layout_width="0dp"
android:textSize="11sp"
android:layout_height="wrap_content"
android:text="Total"
android:layout_weight="1"
android:id="#+id/total"/>
</TableRow>
</TableLayout>
</LinearLayout>
</HorizontalScrollView>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/horizontal"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="20dp"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tolak"
android:id="#+id/tolak"
android:background="#drawable/buttonback2"
android:layout_alignParentRight="true"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Approve"
android:layout_alignParentLeft="true"
android:id="#+id/btnapprove"
android:background="#drawable/buttonback"
/>
</RelativeLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
Set
android:nestedScrollingEnabled="true"
Use:
android:nestedScrollingEnabled="false"
it's working for me
I am having five columns displaying data,the issue i am facing is the fifth column data is not visible its getting hidden as well the column heading and the data are not getting properly aligned.Following is my xml for data display
<TextView
android:id="#+id/textView1"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:text="TextView" />
<TextView
android:id="#+id/textViewStyle"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:text="23" />
</LinearLayout>
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content" android:orientation="vertical">
<TextView
android:id="#+id/textView2"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:text="TextView" />
<TextView
android:id="#+id/textView21"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:text="23" />
<TextView
android:id="#+id/textView22"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:text="23" />
</LinearLayout>
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content" android:orientation="vertical">
<TextView
android:id="#+id/textView3"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:text="455" />
<TextView
android:id="#+id/textView31"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:text="554" />
<TextView
android:id="#+id/textView32"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:text="755" />
</LinearLayout>
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content" android:orientation="vertical">
<TextView
android:id="#+id/textView4"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:textColor="#000000"
android:textSize="10dp"
android:text="6654" />
<TextView
android:id="#+id/textView41"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:text="7676" />
<TextView
android:id="#+id/textView42"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:text="7765" />
</LinearLayout>
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content" android:orientation="vertical">
<TextView
android:id="#+id/textView5"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:textColor="#000000"
android:textSize="10dp"
android:text="12" />
<TextView
android:id="#+id/textView51"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:textColor="#000000"
android:textSize="10dp"
android:text="45" />
<TextView
android:id="#+id/textView52"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:textColor="#000000"
android:textSize="10dp"
android:text="644" />
</LinearLayout>
</LinearLayout>
and the listview xml is has below
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#android:color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:layout_margin="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="12345617890" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:fontFamily="#android:color/black"
android:text="Ramakrisha Tripati" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="9876543210" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_weight="1"
android:layout_margin="10dp"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="13/1/2015" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Rohit Sharma" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="55dp"
android:orientation="horizontal"
android:background="#F5D8BA">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="item#\nstyle#"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="M Wt\nD Wt\nCS Wt"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Making\nD Rate\nCS Rate"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Margin\nDis %\nDiscount"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GT\nFSP"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ListView android:id="#+id/listView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="#00000000"
android:dividerHeight="5dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:textColor="#000000"
android:text="Comment" />
<EditText
android:id="#+id/editText2"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:ems="10"
android:hint="Comment goes here"
android:inputType="textMultiLine" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:orientation="horizontal">
<Button
android:id="#+id/buttonAcc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:padding="10dp"
android:textColor="#000000"
android:background="#drawable/mybutton"
android:layout_marginLeft="20dp"
android:text="Accept" />
<Button
android:id="#+id/buttonRej"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:padding="10dp"
android:textColor="#000000"
android:background="#drawable/mybutton"
android:layout_marginLeft="100dp"
android:text="Reject" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content" android:orientation="vertical">
because of that
why you not use tablelayout?
Just replace your All Linear Layouts under "xml for data display"
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content"
android:orientation="vertical">
With this
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
You can see your fifth Layout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/linhaCliente"
android:clickable="false"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="5dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:background="#drawable/pedidos_shape"
android:layout_height="wrap_content"
android:clickable="false">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="5dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|left"
android:layout_weight="0.28">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/numeroPedido"
android:text="123456 "
android:textStyle="bold"
android:textSize="20dp"
android:textColor="#color/pedidos_cinza"
android:layout_marginRight="5dp"
android:paddingLeft="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/pedidoID"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|right"
android:columnCount="2"
android:layout_weight="0.28"
android:paddingRight="30dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="19/10/2014 às 14:30"
android:id="#+id/data_criado"
android:textStyle="bold"
android:textColor="#color/pedidos_cinza"
android:textSize="15dp"
android:textIsSelectable="false"
android:editable="false"
android:focusable="false"
android:layout_marginTop="3dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingBottom="10dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|left"
android:layout_weight="0.20"
android:paddingRight="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="R$ 16.450,00 "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/valorPedido"
android:paddingLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="(Condição: "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/condicao" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2x "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/condicaoPedido" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:id="#+id/ViewEndereco"
android:layout_height="8dip"
android:layout_width="match_parent"
android:background="#drawable/dot"
android:layerType="software"
android:orientation="horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/statusPedido"
android:text="Status"
android:textColor="#color/pedidos_cinza"
android:textStyle="bold"
android:textSize="20dp"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:padding="10dp" />
</LinearLayout>
</LinearLayout>
The above xml code gives me that result:
I need to add an arrow like the following image:
The problem is that I can't get that arrow to be aligned as it was suppose to be, either I put it aligned with the date or with the price, but I need it to be independent, exactly like the image above.
I manage that doing this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
android:id="#+id/linhaCliente"
android:clickable="false">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="#drawable/pedidos_shape"
android:orientation="vertical"
android:id="#+id/linearLayout8"
android:layout_margin="10dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="horizontal"
android:id="#+id/linearLayout">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="horizontal"
android:id="#+id/linearLayout9">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/numeroPedido"
android:text="123456 "
android:textStyle="bold"
android:textSize="20dp"
android:textColor="#color/pedidos_cinza"
android:layout_marginRight="5dp"
android:paddingLeft="5dp"
android:paddingBottom="5dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="19/10/2014 às 14:30"
android:id="#+id/data_criado"
android:textStyle="bold"
android:textColor="#color/pedidos_cinza"
android:textSize="15dp"
android:gravity="right" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/pedidoID"
android:visibility="gone" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="horizontal"
android:id="#+id/linearLayout10" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="R$ 16.450,00 "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/valorPedido"
android:paddingLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="(Condição: "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/condicao" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2x "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/condicaoPedido" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="#+id/phone"
android:layout_width="48dp"
android:layout_height="48dp"
android:clickable="true"
android:src="#drawable/ic_action_name"
android:background="?attr/selectableItemBackground"
/>
</LinearLayout>
<View
android:id="#+id/ViewEndereco"
android:layout_height="8dip"
android:layout_width="match_parent"
android:background="#drawable/dot"
android:layerType="software"
android:orientation="horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/statusPedido"
android:text="Status"
android:textColor="#color/pedidos_cinza"
android:textStyle="bold"
android:textSize="20dp"
android:padding="10dp" />
</LinearLayout>
</LinearLayout>
I am creating custom tabs which consists of seven tabs using linear layout with imageview and Textview(Child elements) and giving weight equaly to seven tabs. But i need to set first tab width to remaining tabs so that it looks good.How to accompolish this. I am attaching screen shot for your kind reference.
XML File
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#000000">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:requiresFadingEdge="horizontal"
android:fadingEdgeLength="2dp"
android:scrollbarStyle="outsideInset"
android:scrollbarSize="1dp"
android:scrollbarThumbHorizontal="#android:color/darker_gray"
android:overScrollMode="never"
android:fadeScrollbars="false"
android:background="#0668b1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#000000"
android:weightSum="7"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/ll_tab_wodetail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#464646"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_icon_wodetail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:adjustViewBounds="false"
android:src="#drawable/wo_wodetails" />
<TextView
android:id="#+id/tv_icon_wodetail"
style="?android:attr/tabWidgetStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="W/O Details"
android:textColor="#ffffff"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ll_tab_details"
android:background="#464646"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_icon_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:src="#drawable/wo_details"
android:adjustViewBounds="false" />
<TextView
android:id="#+id/tv_icon_wodetail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Details"
android:textSize="16sp"
android:textColor="#ffffff"
style="?android:attr/tabWidgetStyle"
android:gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ll_tab_spares"
android:layout_weight="1"
android:background="#464646"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_icon_spares"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/wo_spares"
android:gravity="center_horizontal"
android:layout_weight="1"
android:adjustViewBounds="false" />
<TextView
android:id="#+id/tv_icon_spares"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Spares"
android:textSize="16sp"
android:textColor="#ffffff"
style="?android:attr/tabWidgetStyle"
android:gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ll_tab_tools"
android:background="#464646"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_icon_tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/wo_tools"
android:gravity="center_horizontal"
android:layout_weight="1"
android:adjustViewBounds="false" />
<TextView
android:id="#+id/tv_icon_tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tools"
android:textSize="16sp"
android:textColor="#ffffff"
style="?android:attr/tabWidgetStyle"
android:gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ll_tab_tasks"
android:background="#464646"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/wo_tasks"
android:gravity="center_horizontal"
android:adjustViewBounds="false" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tasks"
android:textSize="16sp"
android:textColor="#ffffff"
style="?android:attr/tabWidgetStyle"
android:gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ll_tab_costs"
android:background="#464646"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_icon_costs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/wo_costs"
android:gravity="center_horizontal"
android:adjustViewBounds="false" />
<TextView
android:id="#+id/tv_icon_costs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Costs"
android:textSize="16sp"
android:textColor="#ffffff"
style="?android:attr/tabWidgetStyle"
android:gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ll_tab_trades"
android:background="#464646"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_icon_trades"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:src="#drawable/wo_trades"
android:adjustViewBounds="false" />
<TextView
android:id="#+id/tv_icon_trades"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Trades"
android:textSize="16sp"
android:textColor="#ffffff"
style="?android:attr/tabWidgetStyle"
android:gravity="center_horizontal" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
<ScrollView
android:id="#+id/sv_wodetails"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
android:background="#000000">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#000000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/tv_wono"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Work Oder No"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_wonoval"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Large Text"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:background="#drawable/spinner_background"
android:textColor="#ffffff"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_equipment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Equipment"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_equipmentval"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Large Text"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:background="#drawable/spinner_background"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_equipmenthier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Equipment Hierarchy"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_equipmenthierval"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Large Text"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:background="#drawable/spinner_background"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_jobdesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Job Description"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/et_jobdesc"
android:textColor="#ffffff"
android:background="#drawable/spinner_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textSize="18sp">
<requestFocus />
</EditText>
<TextView
android:id="#+id/tv_instruction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Instruction"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:textColor="#ffffff"
android:id="#+id/et_instruction"
android:background="#drawable/spinner_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:layout_marginTop="5dp"
android:textSize="18sp">
<requestFocus />
</EditText>
<TextView
android:id="#+id/tv_safetynotes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Safety Notes"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/et_safetynotes"
android:background="#drawable/spinner_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:layout_marginTop="5dp"
android:textSize="18sp">
<requestFocus />
</EditText>
<TextView
android:id="#+id/tv_wotype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="W/O Type"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_wotypeval"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="WO TYPE"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:background="#drawable/spinner_background"
android:textColor="#ffffff"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceLarge" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dip"
android:orientation="vertical" />
</LinearLayout>
</RelativeLayout>