Android TV Layout gets auto deformed - android

I am trying to develop a Launcher for Android TV, When ever i go to any other activity through the launcher and then return to the main UI, then the layout changes itself. Can anyone please let me know what is the mistake I am doing in designing the UI.
Here is XML 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="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:grid="http://schemas.android.com/tools"
app:orientation="horizontal"
android:background="#color/colorAccent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="48dp"
android:layout_alignParentLeft="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="0.5">
<TextClock
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textClock"
android:textSize="32sp"
android:textColor="#ffffff"
android:layout_gravity="end"
grid:targetApi="jelly_bean_mr1" />
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="horizontal"
android:layout_weight="0.5"
android:id="#+id/weather">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/sun" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="right"
android:id="#+id/temp"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="48dp"
android:layout_alignParentRight="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
android:id="#+id/sdcard"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
android:id="#+id/ethernet"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_right"
android:padding="4dp"
android:id="#+id/bluetooth"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_search"
android:padding="4dp"
android:id="#+id/wifi"/>
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="108dp"
android:layout_marginLeft="96dp"
android:layout_marginRight="96dp"
android:layout_marginBottom="96dp"
android:gravity="center_horizontal">
<android.support.v7.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:rowCount="2"
android:layout_toLeftOf="#+id/grla2"
android:id="#+id/grla"
app:columnCount="6">
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:background="#drawable/app_selector"
android:id="#+id/movie"
app:layout_rowSpan="1"
app:layout_columnSpan="1"
app:layout_column="0"
app:layout_row="0">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/fb_movie"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Movies"
android:textSize="24sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="left"/>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:background="#drawable/app_selector"
android:id="#+id/news"
app:layout_rowSpan="1"
app:layout_columnSpan="1"
app:layout_column="1"
app:layout_row="0">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/fb_wcs"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="News"
android:textSize="24sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="right"/>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:background="#drawable/app_selector"
android:id="#+id/favorite"
app:layout_rowSpan="1"
app:layout_columnSpan="1"
app:layout_column="2"
app:layout_row="0">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/fb_market"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Favorites"
android:textSize="24sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="right"/>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:id="#+id/game"
android:background="#drawable/app_selector"
app:layout_rowSpan="1"
app:layout_columnSpan="1"
app:layout_column="3"
app:layout_row="0">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/fb_game"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Games"
android:textSize="24sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="right"/>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:background="#drawable/app_selector"
android:id="#+id/browser"
app:layout_rowSpan="1"
app:layout_columnSpan="1"
app:layout_column="4"
app:layout_row="0">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/fb_browser"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Browser"
android:textSize="24sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="right"/>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:background="#drawable/app_selector"
android:id="#+id/livetv"
app:layout_rowSpan="1"
app:layout_columnSpan="1"
app:layout_column="5"
app:layout_row="0">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/fb_xbmc"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Live TV"
android:textSize="24sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="right"/>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:background="#drawable/app_selector"
android:id="#+id/music"
app:layout_rowSpan="1"
app:layout_columnSpan="1"
app:layout_column="0"
app:layout_row="1">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/fb_music"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Music"
android:textSize="24sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="right"/>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:background="#drawable/app_selector"
android:id="#+id/social"
app:layout_rowSpan="1"
app:layout_columnSpan="1"
app:layout_row="1"
app:layout_column="1">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/fb_social"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Social"
android:textSize="24sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="right"/>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:background="#drawable/app_selector"
android:id="#+id/shopping"
app:layout_rowSpan="1"
app:layout_columnSpan="1"
app:layout_row="1"
app:layout_column="2">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/fb_nv"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Shopping"
android:textSize="24sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="right"/>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:background="#drawable/app_selector"
app:layout_rowSpan="1"
app:layout_columnSpan="3">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/slide_show"
android:layout_marginRight="24dp"
android:layout_marginBottom="4dp"
android:scaleType="centerCrop" />
</FrameLayout>
</android.support.v7.widget.GridLayout>
<android.support.v7.widget.GridLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
app:rowCount="4"
android:layout_margin="2dp"
android:id="#+id/grla2"
app:columnCount="1">
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:background="#drawable/app_selector"
android:id="#+id/devices"
app:layout_column="0"
app:layout_row="0"
app:layout_rowSpan="1"
app:layout_columnSpan="1">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/fb_devices"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Device"
android:textSize="24sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="right"/>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:background="#drawable/app_selector"
android:id="#+id/allapps"
app:layout_column="0"
app:layout_row="1"
app:layout_rowSpan="1"
app:layout_columnSpan="1">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/fb_allapps"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="All Apps"
android:textSize="24sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="right"/>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:background="#drawable/app_selector"
android:id="#+id/settings"
app:layout_column="0"
app:layout_row="2"
app:layout_rowSpan="1"
app:layout_columnSpan="1">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/fb_settings"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Settings"
android:textSize="24sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="right"/>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="4dp"
android:background="#drawable/app_selector"
android:id="#+id/cleanup"
app:layout_column="0"
app:layout_row="3"
app:layout_rowSpan="1"
app:layout_columnSpan="1">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/fb_speedup"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="SpeedUp"
android:textSize="24sp"
android:textColor="#ffffff"
android:textStyle="bold"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:layout_gravity="right"/>
</FrameLayout>
</android.support.v7.widget.GridLayout>
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/bottom_recycler"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:clipToPadding="false"/>
</RelativeLayout>

you use Relative layout then you need to care about align but if you want to divide your screen in equal part then use Linear Layout and weight also. I Paste some of code that is help you and i hope your problem is solved
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:grid="http://schemas.android.com/tools"
app:orientation="horizontal"
android:background="#color/colorAccent">
<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=".2"
android:padding="5dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="bottom"
android:background="#color/blue">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Your Text"
android:textSize="20sp"
android:textColor="#color/black"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="bottom|right"
android:layout_marginLeft="5dp"
android:background="#color/blue">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Your Text"
android:textSize="20sp"
android:textColor="#color/black"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".8"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:padding="5dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:background="#color/colorPrimary">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:background="#color/colorPrimary">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:background="#color/colorPrimary">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:background="#color/colorPrimary">
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:padding="5dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:background="#color/colorPrimary">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:background="#color/colorPrimary">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:background="#color/colorPrimary">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:background="#color/colorPrimary">
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".2"
android:padding="5dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginBottom="5dp"
android:background="#color/colorPrimary">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginBottom="5dp"
android:background="#color/colorPrimary">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginBottom="5dp"
android:background="#color/colorPrimary">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginBottom="5dp"
android:background="#color/colorPrimary">
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".1"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

Related

Last item in layout not appear

I am working on android app
and i have cart activity which have multi row of products
and then the total of cart and button to continue..
This layout have top and buttom bars and then Scrollview have linearLayout as child...
This child contain:
Recyclerview
Textboxes
Button
My problem is: I cant scroll to the last item in my layout (The Button) .
This is my xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:layout_alignParentTop="true">
<ImageView
android:id="#+id/ProgressBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:src="#drawable/progress_rec"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="#+id/overview_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/backgroudn"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/tt"
>
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "70dp"
android:elevation="12dp"
android:padding="8dp"
android:background="#drawable/white_action_bar"
android:id="#+id/first"
android:orientation="horizontal"
android:weightSum="1">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:elevation="12dp"
android:id="#+id/btnActionBar11"
android:drawableStart="#drawable/ic_arrow_back_black_24dp"
android:drawableLeft="#drawable/ic_arrow_back_black_24dp"
android:drawablePadding="8dp"
android:drawableTint="#color/colorPrimaryDark"
android:padding="8dp"
android:background="#android:color/transparent"
android:layout_weight="0.2" />
<TextView
android:layout_width = "0dp"
android:layout_height = "wrap_content"
android:gravity="center"
android:textSize="14sp"
android:padding="8dp"
android:text="#string/cart"
android:layout_marginTop="8dp"
android:id="#+id/tvActionBar"
android:textColor="#color/colorPrimaryDark"
android:layout_weight="0.5"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:id="#+id/btnActionBarEnd11"
android:padding="8dp"
android:drawableEnd="#drawable/ic_shopping_cart_black_24dp"
android:drawableRight="#drawable/ic_shopping_cart_black_24dp"
android:drawablePadding="8dp"
android:drawableTint="#color/colorPrimaryDark"
android:textColor="#color/colorPrimaryDark"
android:background="#android:color/transparent"
android:layout_weight="0.3"
android:textSize="12sp"
android:visibility="gone"/>
</LinearLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:layout_below="#+id/first">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/no_data"
android:text="#string/no_data"
android:textSize="24sp"
android:textAlignment="center"
android:gravity="center"
android:textColor="#color/colorPrimary"
android:visibility="gone"/>
<ProgressBar
android:foregroundGravity="center"
android:id="#+id/progress"
android:layout_below="#+id/no_data"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="#android:color/transparent"
android:layout_gravity="center"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cartContentList"
android:layoutAnimation="#anim/layout_animation"
app:layout_behavior="#string/appbar_scrolling_view_behavior"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp"
android:weightSum="1"
android:id="#+id/totalLayout">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="1"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:text="#string/total"
android:textSize="#dimen/medium"
android:textColor="#color/colorPrimaryDark"
android:gravity="center"
/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:text="#string/zero_dollar"
android:textSize="#dimen/medium"
android:textColor="#color/colorPrimaryDark"
android:gravity="center"
android:id="#+id/tvTotal"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/round_button"
android:text="#string/continue_"
android:textColor="#color/white"
android:textSize="#dimen/medium"
android:layout_margin="8dp"
android:padding="8dp"
android:gravity="center"
android:id="#+id/btnContinue" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="8dp"
android:paddingTop="8dp"
android:id="#+id/any"
android:background="#drawable/white_menu_bar"
android:layout_alignParentBottom="true"
android:elevation="24dp">
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "40dp"
android:elevation="12dp"
android:padding="2dp"
android:id="#+id/end"
android:orientation="horizontal"
android:weightSum="1"
android:gravity="center_horizontal">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:background="#android:color/transparent"
android:drawableTop="#drawable/home_1"
android:layout_margin="8dp"
android:gravity="center"
android:layout_gravity="center"
android:textColor="#color/colorPrimaryDark"
android:paddingEnd="15dp"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:background="#android:color/transparent"
android:textColor="#color/colorPrimaryDark"
android:gravity="center"
android:layout_gravity="center"
android:id="#+id/btnMyOrder"
android:drawableTop="#drawable/my_orders_1"
android:layout_margin="8dp"
android:paddingEnd="15dp"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:background="#android:color/transparent"
android:textColor="#color/colorPrimaryDark"
android:gravity="center"
android:layout_gravity="center"
android:drawableTop="#drawable/notifications_1"
android:layout_margin="8dp"
android:paddingEnd="18dp"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:background="#android:color/transparent"
android:drawableTop="#drawable/side_menu_1"
android:layout_marginTop="8dp"
android:drawableTint="#color/colorPrimaryDark"
android:layout_gravity="center"
android:paddingEnd="15dp"/>
</LinearLayout>
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "20dp"
android:elevation="12dp"
android:id="#+id/end1"
android:orientation="horizontal"
android:weightSum="1"
android:gravity="center_horizontal">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:id="#+id/gr1Home1"
android:drawableTop="#drawable/component1"
android:background="#android:color/transparent"
android:layout_weight="0.25"
android:paddingTop="8dp"
android:drawablePadding="15dp"
android:visibility="visible"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:id="#+id/gr2Notification1"
android:drawableTop="#drawable/component1"
android:background="#android:color/transparent"
android:layout_weight="0.25"
android:padding="8dp"
android:drawablePadding="15dp"
android:visibility="invisible"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:id="#+id/gr3Message1"
android:drawableTop="#drawable/component1"
android:background="#android:color/transparent"
android:layout_weight="0.25"
android:padding="8dp"
android:drawablePadding="15dp"
android:visibility="invisible"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:id="#+id/gr4Calender1"
android:drawableTop="#drawable/component1"
android:background="#android:color/transparent"
android:layout_weight="0.25"
android:padding="8dp"
android:drawablePadding="15dp"
android:visibility="invisible"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
.
This is my Cart Activity XMl:
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/cart_bg"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/cart_bg"
android:orientation="vertical">
<include
android:id="#+id/abl_main1"
layout="#layout/app_header_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<LinearLayout
android:id="#+id/ll_item_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/abl_main1"
android:orientation="horizontal">
<TextView
android:id="#+id/tv_item_count_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/montserrat"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="5dp"
android:paddingBottom="10dp"
android:text="#string/my_cart"
android:textColor="#color/text_item"
android:textSize="#dimen/text_size_18"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_item_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/montserrat"
android:paddingLeft="0dp"
android:paddingTop="10dp"
android:paddingRight="5dp"
android:paddingBottom="10dp"
android:text="#string/my_cart"
android:textColor="#color/gray_9E"
android:textSize="#dimen/text_size_12"
android:textStyle="normal" />
<TextView
android:id="#+id/tv_total"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:fontFamily="#font/montserrat"
android:gravity="right"
android:padding="10dp"
android:text="#string/total_caps"
android:textColor="#color/text_item"
android:textStyle="bold"
android:visibility="gone" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/ll_item_count">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="60dp"
android:visibility="visible">
<LinearLayout
android:id="#+id/ll_listing"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="visible">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rcv_cart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:background="#android:color/transparent"
android:clipToPadding="false"
android:orientation="vertical"
android:visibility="visible"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<androidx.cardview.widget.CardView
style="#style/CardView.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:background="#color/white"
app:cardCornerRadius="4dp">
<LinearLayout
android:id="#+id/ll_playable"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
android:visibility="gone">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:text="#string/cart_total"
android:textColor="#color/text_item"
android:textStyle="normal" />
<TextView
android:id="#+id/tv_cart_total"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:gravity="right"
android:text=""
android:textColor="#color/text_item"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:text="#string/total"
android:textColor="#color/text_item"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_sub_total"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:gravity="right"
android:text=""
android:textColor="#color/text_item"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
android:visibility="gone">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:text="#string/discount"
android:textColor="#color/text_item"
android:textStyle="normal" />
<TextView
android:id="#+id/tv_discount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:gravity="right"
android:text=""
android:textColor="#color/text_item"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
android:visibility="gone">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:text="#string/dilivery"
android:textColor="#color/text_item"
android:textStyle="normal" />
<TextView
android:id="#+id/tv_delivery"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:gravity="right"
android:text=""
android:textColor="#color/text_item"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
android:visibility="gone">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:text="#string/total_payable"
android:textColor="#color/text_item"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_total_payable"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:gravity="right"
android:text=""
android:textColor="#color/text_item"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/montserrat"
android:maxLines="2"
android:text="#string/tax_and_shipping_calculated"
android:textColor="#color/text_item"
android:textSize="#dimen/text_size_15"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical"
android:paddingTop="10dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/margin5dp"
android:fontFamily="#font/montserrat"
android:text="#string/add_order_note"
android:textColor="#color/text_item" />
<EditText
android:id="#+id/ed_order_note"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/shape_rectangle_transperant_bg_app_color_border"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="top|left"
android:hint="#string/how_can_we_help_you"
android:imeOptions="actionDone"
android:isScrollContainer="false"
android:lines="3"
android:maxLines="3"
android:overScrollMode="always"
android:padding="#dimen/margin5dp"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
android:textColor="#color/text_item" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/rr_empty_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/ll_item_count"
android:layout_centerInParent="true"
android:background="#color/white"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center_vertical"
android:orientation="vertical">
<LinearLayout
android:id="#+id/ll_backgorund_circle_cart"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:background="#drawable/circle_drawable"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_background_icon_cart"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_horizontal"
android:src="#mipmap/iv_red_heart"
android:visibility="visible" />
</LinearLayout>
<TextView
android:id="#+id/tv_empty_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/padding_10"
android:layout_marginTop="#dimen/text_size_20"
android:layout_marginRight="#dimen/padding_10"
android:fontFamily="#font/montserrat"
android:gravity="center"
android:text="#string/your_bag_is_empty"
android:textColor="#color/text_item"
android:textSize="20dp"
android:textStyle="bold"
android:visibility="visible" />
<TextView
android:id="#+id/tv_empty_sub_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/padding_10"
android:layout_marginTop="#dimen/padding_10"
android:layout_marginRight="#dimen/padding_10"
android:layout_marginBottom="30dp"
android:fontFamily="#font/montserrat"
android:gravity="center"
android:text="#string/item_added_to_bag"
android:textColor="#color/gray_9E"
android:textSize="16dp"
android:textStyle="normal"
android:visibility="visible" />
<LinearLayout
android:id="#+id/ll_shopping_now"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/shape_rectangle_transperant_bg_app_color_border_new"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<TextView
android:id="#+id/tv_shopping_now"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/input_layout_password"
android:layout_alignParentStart="true"
android:layout_gravity="center_horizontal"
android:fontFamily="#font/montserrat"
android:gravity="center"
android:padding="#dimen/padding_10"
android:text="#string/shopping_now"
android:textColor="#color/black"
android:textSize="16dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<View
android:id="#+id/v_order_place"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_above="#+id/ll_place_order"
android:background="#color/light_gray" />
<LinearLayout
android:id="#+id/ll_place_order"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/white"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight=".5"
android:gravity="center"
android:orientation="vertical"
android:padding="5dp">
<TextView
android:id="#+id/tv_place_order_total"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="#font/montserrat"
android:gravity="center"
android:text=""
android:textColor="#color/text_item"
android:textStyle="bold" />
</LinearLayout>
<com.wpa3.productshopify.util.RippleView
rv_centered="true"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
app:rv_type="rectangle"
app:rv_zoom="true">
<TextView
android:id="#+id/tv_place_order"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_weight=".5"
android:background="#drawable/shape_round_corner_rectangle"
android:fontFamily="#font/montserrat"
android:gravity="center"
android:padding="10dp"
android:text="#string/place_order"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="15sp" />
</com.wpa3.productshopify.util.RippleView>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
Right now i'm busy so did not seen your XML but check my code snippet.
Hope this may help you

to save data of two or more recycler view on one activity in android

In an activity adding listing view on button click.
In the main view on saving click, I need to save all listing data same time.
this is my main view where adding the list
<layout
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:background="#color/black"
android:layout_height="match_parent">
<include layout="#layout/toolbar_text" android:id="#+id/mytool"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginBottom="10dp"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/layoutRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp"
android:background="#color/colorPrimary"
android:layout_marginTop="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="15dp"
android:layout_marginStart="15dp">
<TextView
android:id="#+id/txtMeal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Protocol is for"/>
<!-- <ImageView
android:id="#+id/ivDelete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/iv_delete"
android:onClick="onClick"
android:layout_alignParentRight="true" />-->
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="15dp"
android:layout_marginTop="10dp"
android:background="#drawable/edit_gradient"
android:layout_marginEnd="20dp">
<!-- <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#null"
android:paddingTop="5dp"
android:text="My self"
android:paddingBottom="5dp"
android:paddingStart="15dp"
android:textSize="14sp"
android:layout_centerVertical="true"
android:singleLine="true"
android:textColor="#color/white" />-->
<Spinner
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:id="#+id/spinProtocol"
android:layout_alignParentRight="true">
</Spinner>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start date"
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
android:textColor="#color/white"/>
<RelativeLayout
android:id="#+id/rlStartDate"
android:layout_width="match_parent"
android:onClick="onClick"
android:layout_height="60dp"
android:layout_marginStart="15dp"
android:layout_marginTop="10dp"
android:background="#drawable/edit_gradient"
android:layout_marginEnd="20dp">
<TextView
android:id="#+id/txtStartDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#null"
android:paddingTop="5dp"
android:text="select date"
android:paddingBottom="5dp"
android:paddingStart="15dp"
android:textSize="14sp"
android:layout_centerVertical="true"
android:singleLine="true"
android:textColor="#color/white" />
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="#drawable/calendar"
android:layout_marginEnd="15dp"
android:id="#+id/imgProStartDate"
android:tint="#color/red"
android:layout_centerVertical="true"
android:layout_alignParentRight="true">
</ImageView>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="End date"
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
android:textColor="#color/white"/>
<RelativeLayout
android:id="#+id/rlEndDate"
android:layout_width="match_parent"
android:onClick="onClick"
android:layout_height="60dp"
android:layout_marginStart="15dp"
android:layout_marginTop="10dp"
android:background="#drawable/edit_gradient"
android:layout_marginEnd="20dp">
<TextView
android:id="#+id/txtEndDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#null"
android:paddingTop="5dp"
android:text="end date"
android:paddingBottom="5dp"
android:paddingStart="15dp"
android:textSize="14sp"
android:layout_centerVertical="true"
android:singleLine="true"
android:textColor="#color/white" />
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="#drawable/calendar"
android:layout_marginEnd="15dp"
android:id="#+id/imgProEndDate"
android:tint="#color/red"
android:layout_centerVertical="true"
android:layout_alignParentRight="true">
</ImageView>
</RelativeLayout>
</LinearLayout>
<!--Workout selected lisating -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp"
android:background="#color/colorPrimary"
android:layout_marginTop="5dp">
<LinearLayout
android:id="#+id/viewLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp">
</LinearLayout>
<Button
android:id="#+id/btnAddMeal"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="15dp"
android:text="ADD MORE WORKOUT"
android:textColor="#color/white"
android:onClick="onClick"
android:layout_gravity="center_horizontal"/>
</LinearLayout>
<!--<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/layout_workout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp"
android:background="#color/colorPrimary"
android:layout_marginTop="10dp">
<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:text="Workout Name: 1"
android:id="#+id/workout_name"
android:layout_marginStart="5dp"
android:layout_marginTop="15dp"
android:textColor="#color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="15dp"
android:layout_alignEnd="#+id/workout_name"
android:textColor="#color/white"/>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="#drawable/ic_edit_white"
android:layout_marginEnd="15dp"
android:id="#+id/ivEdit"
android:layout_marginTop="15dp"/>
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:src="#drawable/ic_close"
android:layout_marginEnd="15dp"
android:id="#+id/ivDelelte"
android:layout_marginTop="15dp"
android:tint="#color/white"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_30sdp"
android:background="#color/red">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_10sdp"
android:text="Excercise"
android:layout_weight="2"
android:layout_gravity="center"
android:textColor="#color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sets"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="#color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Reps"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="#color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rest(s)"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="#color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Temp"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="#color/white"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/_5sdp"
tools:listitem="#layout/user_workout_list"
android:id="#+id/selected_excercise_list"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+ Add Excercises"
android:id="#+id/add_excercise"
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
android:textColor="#color/red"/>
</LinearLayout>
</LinearLayout>-->
<!--Workout name -->
<!-- <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp"
android:background="#color/colorPrimary"
android:layout_marginTop="5dp">
<LinearLayout
android:id="#+id/viewLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp">
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/btnAddMeal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:padding="15dp"
android:text="ADD More WORKOUT"
android:drawableStart="#drawable/add"
android:drawablePadding="5dp"
android:layout_centerHorizontal="true"
android:layout_marginStart="15dp"
android:textColor="#color/white"
android:background="#drawable/button_gray_gredient"
android:onClick="onClick"/>
</RelativeLayout>
</LinearLayout>-->
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
android:layout_marginStart="15dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="15dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight=".50"
android:layout_gravity="center"
android:id="#+id/llDraft"
android:layout_marginEnd="10dp"
android:gravity="center"
android:background="#drawable/rect_border">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SAVE TO DRAFT"
android:fontFamily="#font/rubik_bold"
android:textColor="#color/text_color"
android:layout_gravity="center"
android:gravity="center_horizontal"/>
</LinearLayout>
<LinearLayout
android:id="#+id/llSave"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight=".50"
android:layout_gravity="center"
android:onClick="onClick"
android:gravity="center"
android:layout_marginStart="10dp"
android:background="#drawable/button_red_gredient">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SAVE "
android:fontFamily="#font/rubik_bold"
android:textColor="#color/white"
android:layout_gravity="center"
android:gravity="center_horizontal"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</layout>
And this is my listing view which I can add on button click maximum 5 views and now I need to save all listing data which added in the main view in android.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/layoutRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp"
android:background="#color/colorPrimary"
android:layout_marginTop="10dp">
<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:text="Workout Name 1"
android:id="#+id/workout_name"
android:layout_marginStart="5dp"
android:layout_marginTop="15dp"
android:textColor="#color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="15dp"
android:layout_alignEnd="#+id/workout_name"
android:textColor="#color/white"/>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="#drawable/ic_edit_white"
android:layout_marginEnd="15dp"
android:id="#+id/ivEdit"
android:layout_marginTop="15dp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/iv_delete"
android:padding="#dimen/_2sdp"
android:layout_marginEnd="15dp"
android:id="#+id/ivDelelte"
android:layout_marginTop="15dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_30sdp"
android:background="#color/red">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_10sdp"
android:text="Excercise"
android:layout_weight="2"
android:layout_gravity="center"
android:textColor="#color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sets"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="#color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Reps"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="#color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rest(s)"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="#color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Temp"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="#color/white"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/excercise_list"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+ Add Excercises"
android:id="#+id/add_program_excercise"
android:clickable="true"
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
android:textColor="#color/red"/>
</LinearLayout>
</LinearLayout>

how to set textview horizontally inside linearlayout

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/colorSlate"
android:orientation="vertical">
<TextView
android:id="#+id/hello"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#5d737e"
android:padding="20dp"
android:text="₹ 250.00"
android:textColor="#color/colorWhite" />
</LinearLayout>
<LinearLayout
android:id="#+id/world"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/colorTurquoiseBlue"
android:onClick="#{()->upgradeViewModel.gotoPremimum()}"
android:orientation="horizontal"
android:padding="20dp"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="sans-serif-medium"
android:letterSpacing="-0.03"
android:text="Go premium"
android:textColor="#color/colorWhite"
android:textSize="14.4sp"
android:textStyle="normal" />
<ImageView
android:layout_width="8dp"
android:layout_height="14dp"
android:layout_gravity="center"
android:layout_weight=".5"
app:srcCompat="#drawable/ic_arrow_white"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
This is my xml i am trying to display text horizontally in first linear-layout but when i try to insert another text-view below text-view inside linear-layout i am my first linear-layout get increase not fit with second layout please suggest me how to achieve this i want set text below 200 in given screen
Try this:
<RelativeLayout
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:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/hello"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#5d737e"
android:paddingStart="20dp"
android:paddingTop="10dp"
android:layout_weight="0.5"
android:textSize="15sp"
android:text="₹ 250.00"
/>
<TextView
android:id="#+id/hello1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#5d737e"
android:paddingStart="20dp"
android:paddingBottom="10dp"
android:textSize="15sp"
android:layout_weight="0.5"
android:text="₹ 250.00"
/>
</LinearLayout>
<LinearLayout
android:id="#+id/world"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:onClick="#{()->upgradeViewModel.gotoPremimum()}"
android:orientation="horizontal"
android:padding="20dp"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="sans-serif-medium"
android:letterSpacing="-0.03"
android:text="Go premium"
android:textSize="14.4sp"
android:textStyle="normal" />
<ImageView
android:layout_width="8dp"
android:layout_height="14dp"
android:layout_gravity="center"
android:layout_weight=".5"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Use the layout below . I have changes some attributes to default you can reset them as per your requirement.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#color/blue_end"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/hello"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="₹ 250.00"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/subscription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="4dp"
android:text="Subscription"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:id="#+id/world"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/transparent_black"
android:orientation="horizontal"
android:padding="20dp"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="sans-serif-medium"
android:letterSpacing="-0.03"
android:text="Go premium"
android:textSize="14.4sp"
android:textStyle="normal" />
<ImageView
android:layout_width="8dp"
android:layout_height="14dp"
android:layout_gravity="center"
android:layout_weight=".5"
android:src="#mipmap/ic_launcher" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:padding="10dp"
android:gravity="center"
android:layout_gravity="center"
android:background="#5d737e"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/hello"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="₹ 250.00"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/hello2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Yearly Subscription"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:id="#+id/world"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="#{()->upgradeViewModel.gotoPremimum()}"
android:orientation="horizontal"
android:padding="20dp"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="sans-serif-medium"
android:letterSpacing="-0.03"
android:text="Go premium"
android:textColor="#000"
android:textSize="14.4sp"
android:textStyle="normal" />
<ImageView
android:layout_width="8dp"
android:layout_height="14dp"
android:layout_gravity="center"
android:layout_weight=".5"
app:srcCompat="#drawable/ic_arrow_white"
/>
</LinearLayout>
</LinearLayout>
try this. :)

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();

Linear layout issue

i want to have UI like this .
I managed to do something to achieve this but i am not satisfied . I have pasted the image shows output of my code .
Please help me by improving my code or giving suggestions .
Mycode.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:id="#+id/layout1"
tools:context="com.example.shipra.testing.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal"
android:background="#dddddd"
android:id="#+id/layout2"
android:weightSum="1">
<LinearLayout
android:layout_width="50dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="0.3"
android:weightSum="0.3">
<TextView
android:layout_width="30dp"
android:layout_height="wrap_content"
android:text="POST ID:"
android:layout_gravity="center"
android:textSize="10sp"
android:layout_marginStart="5dp"
android:layout_weight="0.1"
android:textColor="#ababae"/>
<TextView
android:layout_width="30dp"
android:layout_height="match_parent"
android:text="NEW12"
android:textSize="10sp"
android:id="#+id/postId_textview"
android:textStyle="bold"
android:layout_weight="0.2"
android:layout_gravity="center"
android:gravity="center_vertical" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="0.2"
android:weightSum="0.2">
<TextView
android:layout_width="30dp"
android:layout_height="match_parent"
android:text="Pick Date:"
android:layout_gravity="center"
android:gravity="center_vertical"
android:layout_marginStart="2dp"
android:layout_weight="0.1"
android:textSize="10sp"
android:textColor="#ababae"/>
<TextView
android:layout_width="50dp"
android:layout_height="match_parent"
android:text="16 Jan 2016"
android:textStyle="bold"
android:textSize="10sp"
android:layout_weight="0.1"
android:id="#+id/pickDate_textview"
android:layout_gravity="center"
android:gravity="center_vertical"/>
</LinearLayout>
<android.support.v7.widget.AppCompatTextView
android:layout_width="50dp"
android:layout_height="20dp"
android:layout_weight="0.3"
android:textSize="10sp"
android:layout_gravity="center_vertical"
android:text="2 TRAILER of 22 tons"/>
<ImageView
android:layout_width="10dp"
android:layout_height="20dp"
android:id="#+id/view1"
android:layout_gravity="center_vertical"
android:background="#android:drawable/ic_menu_close_clear_cancel"
android:layout_weight="0.2"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_below="#+id/layout2"
android:id="#+id/layout5"
android:orientation="horizontal"
android:weightSum="1.4">
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginStart="2dp"
android:background="#dddddd"
android:layout_weight="0.1"/>
<LinearLayout
android:layout_width="70dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/layout3"
android:layout_marginTop="10dp"
android:layout_weight="0.2"
android:weightSum="0.2"
android:layout_marginStart="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="10dp"
android:text="Vehicle Number"
android:textColor="#3f464d"
android:textSize="10sp"
android:layout_weight="0.1"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="10sp"
android:layout_weight="0.1"
android:id="#+id/vehiclenumber_textview"
android:text="Vehicle number"/>
</LinearLayout>
<View
android:layout_width="7dp"
android:layout_height="match_parent"
android:id="#+id/view2"
android:layout_weight="0.1"
android:background="#dddddd"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/layout4"
android:gravity="center_horizontal"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="50dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.2"
android:weightSum="0.2">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="Prefered Route"
android:layout_weight="0.1"
android:textColor="#3f464d"
android:textStyle="bold"
android:textSize="10sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.1"
android:text="Route"
android:textSize="10sp"
android:id="#+id/route_textview"
android:textColor="#3f464d"/>
</LinearLayout>
<LinearLayout
android:layout_width="63dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.2"
android:layout_marginStart="2dp"
android:weightSum="0.2">
<TextView
android:layout_width="70dp"
android:layout_height="0dp"
android:text="Lowest Market Vehicle Rate"
android:layout_weight="0.1"
android:textColor="#3f464d"
android:textSize="10sp"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.1"
android:textSize="10sp"
android:text="#string/text"
android:textColor="#3f464d"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.2"
android:layout_marginStart="2dp"
android:weightSum="0.2">
<TextView
android:layout_width="70dp"
android:layout_height="0dp"
android:text="Highest Market Load Rate"
android:layout_weight="0.1"
android:textColor="#3f464d"
android:textSize="10sp"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.1"
android:textSize="10sp"
android:layout_marginStart="2dp"
android:text="No load offer"
android:textColor="#3f464d"/>
</LinearLayout>
<LinearLayout
android:layout_width="45dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.2"
android:weightSum="0.2">
<TextView
android:layout_width="50dp"
android:layout_height="30dp"
android:text="Your Rate Per Ton"
android:layout_weight="0.1"
android:layout_marginStart="5dp"
android:textColor="#3f464d"
android:textSize="10sp"
android:textStyle="bold"/>
<EditText
android:layout_width="match_parent"
android:layout_height="30dp"
android:hint="#string/Rs"
android:id="#+id/ruppee_textview"
android:textSize="10sp"/>
</LinearLayout>
<Button
android:layout_width="40dp"
android:layout_height="30dp"
android:layout_weight="0.2"
android:text="update"
android:textSize="8sp"
android:layout_marginTop="20dp"/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="100dp"
android:layout_weight="0.1"
android:layout_toRightOf="#id/layout4"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="#+id/layout5"
android:background="#dddddd"/>
</RelativeLayout>
With the above code i am getting output :
Try like this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/horizontalScrollView"
xmlns:android="http://schemas.android.com/apk/res/android" >
<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:layout_marginTop="10dp"
android:id="#+id/layout1"
tools:context="com.example.shipra.testing.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal"
android:background="#dddddd"
android:id="#+id/layout2"
android:weightSum="1">
<LinearLayout
android:layout_width="50dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="0.3"
android:weightSum="0.3">
<TextView
android:layout_width="30dp"
android:layout_height="wrap_content"
android:text="POST ID:"
android:layout_gravity="center"
android:textSize="10sp"
android:layout_marginStart="5dp"
android:layout_weight="0.1"
android:textColor="#ababae"/>
<TextView
android:layout_width="30dp"
android:layout_height="match_parent"
android:text="NEW12"
android:textSize="10sp"
android:id="#+id/postId_textview"
android:textStyle="bold"
android:layout_weight="0.2"
android:layout_gravity="center"
android:gravity="center_vertical" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="0.2"
android:weightSum="0.2">
<TextView
android:layout_width="30dp"
android:layout_height="match_parent"
android:text="Pick Date:"
android:layout_gravity="center"
android:gravity="center_vertical"
android:layout_marginStart="2dp"
android:layout_weight="0.1"
android:textSize="10sp"
android:textColor="#ababae"/>
<TextView
android:layout_width="50dp"
android:layout_height="match_parent"
android:text="16 Jan 2016"
android:textStyle="bold"
android:textSize="10sp"
android:layout_weight="0.1"
android:id="#+id/pickDate_textview"
android:layout_gravity="center"
android:gravity="center_vertical"/>
</LinearLayout>
<android.support.v7.widget.AppCompatTextView
android:layout_width="50dp"
android:layout_height="20dp"
android:layout_weight="0.3"
android:textSize="10sp"
android:layout_gravity="center_vertical"
android:text="2 TRAILER of 22 tons"/>
<ImageView
android:layout_width="10dp"
android:layout_height="20dp"
android:id="#+id/view1"
android:layout_gravity="center_vertical"
android:background="#android:drawable/ic_menu_close_clear_cancel"
android:layout_weight="0.2"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_below="#+id/layout2"
android:id="#+id/layout5"
android:orientation="horizontal"
android:weightSum="1.4">
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginStart="2dp"
android:background="#dddddd"
android:layout_weight="0.1"/>
<LinearLayout
android:layout_width="70dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/layout3"
android:layout_marginTop="10dp"
android:layout_weight="0.2"
android:weightSum="0.2"
android:layout_marginStart="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="10dp"
android:text="Vehicle Number"
android:textColor="#3f464d"
android:textSize="10sp"
android:layout_weight="0.1"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="10sp"
android:layout_weight="0.1"
android:id="#+id/vehiclenumber_textview"
android:text="Vehicle number"/>
</LinearLayout>
<View
android:layout_width="7dp"
android:layout_height="match_parent"
android:id="#+id/view2"
android:layout_weight="0.1"
android:background="#dddddd"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/layout4"
android:gravity="center_horizontal"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="50dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.2"
android:weightSum="0.2">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="Prefered Route"
android:layout_weight="0.1"
android:textColor="#3f464d"
android:textStyle="bold"
android:textSize="10sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.1"
android:text="Route"
android:textSize="10sp"
android:id="#+id/route_textview"
android:textColor="#3f464d"/>
</LinearLayout>
<LinearLayout
android:layout_width="63dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.2"
android:layout_marginStart="2dp"
android:weightSum="0.2">
<TextView
android:layout_width="70dp"
android:layout_height="0dp"
android:text="Lowest Market Vehicle Rate"
android:layout_weight="0.1"
android:textColor="#3f464d"
android:textSize="10sp"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.1"
android:textSize="10sp"
android:text="#string/text"
android:textColor="#3f464d"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.2"
android:layout_marginStart="2dp"
android:weightSum="0.2">
<TextView
android:layout_width="70dp"
android:layout_height="0dp"
android:text="Highest Market Load Rate"
android:layout_weight="0.1"
android:textColor="#3f464d"
android:textSize="10sp"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.1"
android:textSize="10sp"
android:layout_marginStart="2dp"
android:text="No load offer"
android:textColor="#3f464d"/>
</LinearLayout>
<LinearLayout
android:layout_width="45dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.2"
android:weightSum="0.2">
<TextView
android:layout_width="50dp"
android:layout_height="30dp"
android:text="Your Rate Per Ton"
android:layout_weight="0.1"
android:layout_marginStart="5dp"
android:textColor="#3f464d"
android:textSize="10sp"
android:textStyle="bold"/>
<EditText
android:layout_width="match_parent"
android:layout_height="30dp"
android:hint="#string/Rs"
android:id="#+id/ruppee_textview"
android:textSize="10sp"/>
</LinearLayout>
<Button
android:layout_width="40dp"
android:layout_height="30dp"
android:layout_weight="0.2"
android:text="update"
android:textSize="8sp"
android:layout_marginTop="20dp"/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="100dp"
android:layout_weight="0.1"
android:layout_toRightOf="#id/layout4"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="#+id/layout5"
android:background="#dddddd"/>
</RelativeLayout>
</HorizontalScrollView>
Instead of Relativelayout you can define TableLayout and you can replace LinearLayout with TableRow

Categories

Resources