I'm using the com.sothree.slidinguppanel:library:3.3.1 library for my android slideupPanel but I don't know how to remove the shadow when the overlay layout is starting to show.
overlay shadow
Code Layout
<com.sothree.slidinguppanel.SlidingUpPanelLayout
xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:id="#+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:umanoPanelHeight="0dp"
sothree:umanoShadowHeight="0dp"
sothree:umanoParallaxOffset="0dp"
sothree:umanoDragView="#+id/dragView"
sothree:umanoOverlay="true"
sothree:umanoScrollableView="#+id/main">
<!-- Main Layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/cardview_light_background"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="440dp"
android:layout_weight="1.00"
android:background="#color/cardview_light_background"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#EBEBEB"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout
android:id="#+id/wandurers_info"
android:layout_width="match_parent"
android:layout_height="180dp"
android:orientation="horizontal">
<ImageView
android:id="#+id/imgProfile"
android:layout_width="208dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorMenu"
android:orientation="vertical">
<TextView
android:id="#+id/first_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:paddingTop="20dp"
android:text="MJ"
android:textColor="#android:color/white"
android:textSize="25sp" />
<TextView
android:id="#+id/last_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:text="TextView"
android:textColor="#android:color/white"
android:textSize="25sp" />
<TextView
android:id="#+id/txtWandurerDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.03"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:textColor="#android:color/white"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="180dp"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/surprise_me"
android:layout_width="208dp"
android:layout_height="match_parent"
android:background="#EBEBEB"
android:orientation="vertical">
<TextView
android:id="#+id/surprise"
android:layout_width="208dp"
android:layout_height="wrap_content"
android:paddingLeft="25dp"
android:paddingTop="25dp"
android:text="Surprise"
android:textColor="#android:color/black"
android:textSize="30sp" />
<TextView
android:id="#+id/me"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="25dp"
android:text="Me_"
android:textColor="#android:color/black"
android:textSize="30sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/local_history"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.00"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/local"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="25dp"
android:paddingTop="25dp"
android:text="Local"
android:textColor="#android:color/black"
android:textSize="30sp" />
<TextView
android:id="#+id/history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="25dp"
android:text="History_"
android:textColor="#android:color/black"
android:textSize="30sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="180dp"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/museums_shops"
android:layout_width="207dp"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/museums"
android:layout_width="208dp"
android:layout_height="wrap_content"
android:paddingLeft="25dp"
android:paddingTop="25dp"
android:text="Museums"
android:textColor="#android:color/black"
android:textSize="30sp" />
<TextView
android:id="#+id/shops"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="25dp"
android:text="Shops_"
android:textColor="#android:color/black"
android:textSize="30sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/photowalk"
android:layout_width="205dp"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#EBEBEB"
android:orientation="vertical">
<TextView
android:id="#+id/photo_walk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="25dp"
android:paddingTop="25dp"
android:text="Photowalk_"
android:textColor="#android:color/black"
android:textSize="30sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="62dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorMenu"
android:orientation="horizontal">
<TextView
android:id="#+id/book"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:paddingTop="15dp"
android:text="Book"
android:textAlignment="textEnd"
android:textColor="#color/cardview_light_background"
android:textSize="25sp" />
<TextView
android:id="#+id/txtHour"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:paddingTop="15dp"
android:textAlignment="center"
android:textColor="#color/cardview_light_background"
android:textSize="25sp" />
<TextView
android:id="#+id/hourWalking"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingTop="15dp"
android:text="Hour Walking..."
android:textColor="#color/cardview_light_background"
android:textSize="25sp" />
<TextView
android:id="#+id/orderTour"
android:layout_width="61dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingTop="22dp"
android:text="Order Tour"
android:textAlignment="textEnd"
android:textColor="#color/colorPrimary"
android:textSize="15sp" />
<TextView
android:id="#+id/textViewSelect"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingRight="18dp"
android:paddingTop="15dp"
android:text=">"
android:textAlignment="center"
android:textColor="#color/colorPrimary"
android:textSize="25sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- End of Main Layout -->
<!-- SLIDING LAYOUT -->
<LinearLayout
android:id="#+id/dragView"
android:layout_width="match_parent"
android:layout_height="290dp"
android:layout_alignParentStart="true"
android:background="#color/colorMenu"
android:clickable="true"
android:focusable="false"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingTop="35dp">
<TextView
android:id="#+id/txtViewBook"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.07"
android:text="Book"
android:textColor="#android:color/white"
android:textSize="24sp" />
<TextView
android:id="#+id/txtViewHour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_weight="0.08"
android:text="2"
android:textColor="#android:color/white"
android:textSize="24sp" />
<TextView
android:id="#+id/hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.08"
android:text="Hour"
android:textColor="#android:color/white"
android:textSize="24sp" />
<TextView
android:id="#+id/walkingTour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Walking Tour"
android:textColor="#android:color/white"
android:textSize="24sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/tour_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.07"
android:paddingLeft="20dp"
android:text="Surprise Me"
android:textAlignment="viewStart"
android:textColor="#android:color/white"
android:textSize="24sp" />
<TextView
android:id="#+id/total_amount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:paddingTop="30dp"
android:text="100.00 USD"
android:textColor="#android:color/white"
android:textSize="45sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorMenu"
android:orientation="horizontal"
android:paddingTop="25dp">
<TextView
android:id="#+id/orderTourtext"
android:layout_width="333dp"
android:layout_height="wrap_content"
android:paddingTop="22dp"
android:text="Confirm Booking"
android:textAlignment="textEnd"
android:textColor="#color/colorPrimary"
android:textSize="15sp"
android:layout_weight="0.13" />
<TextView
android:id="#+id/textViewSelected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="8dp"
android:layout_weight="0.24"
android:layout_marginTop="4dp"
android:text=">"
android:textAlignment="center"
android:textColor="#color/colorPrimary"
android:textSize="25sp" />
</LinearLayout>
</LinearLayout>
<!-- END of SLIDING LAYOUT -->
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
I don't know how to remove it, maybe there is a property for it. When I triggered the sliding Panel the overlay shadow started to show and covered the previous UI. What I want is just to remove the shadow of that overlay.
the library now allows you to remove the shadow effect by setting:
app:umanoFadeColor="#android:color/transparent"
in the XML
docs
By default, the main content is dimmed as the panel slides up. You can change the dim color by changing umanoFadeColor. Set it to "#android:color/transparent" to remove dimming completely.
sliding_layout.setShadowHeight(0);
Related
I have this RelativeLayout
<?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:orientation="vertical"
tools:context=".ui.StoreVisitActivity">
<ScrollView
android:id="#+id/scrollable"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="#dimen/_8sdp"
android:layout_marginRight="#dimen/_8sdp"
android:orientation="vertical">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:orientation="horizontal">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:layout_width="#dimen/_55sdp"
android:layout_height="#dimen/_55sdp"
android:src="#drawable/person" />
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_4sdp"
android:text="Paul Phoenix"
android:textColor="#color/main_blue"
android:textSize="#dimen/_14sdp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_4sdp"
android:text="PX2350"
android:textColor="#color/main_blue"
android:textSize="#dimen/_10sdp"
android:textStyle="bold" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
<ImageView
android:layout_width="#dimen/_60sdp"
android:layout_height="#dimen/_30sdp"
android:layout_gravity="center"
android:src="#drawable/company_logo" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_8sdp"
android:layout_marginBottom="#dimen/_2sdp"
android:background="#drawable/bg_border_radius"
android:orientation="vertical"
android:padding="#dimen/_16sdp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_20sdp"
android:layout_marginTop="#dimen/_4sdp"
android:background="#color/main_blue"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:gravity="center"
android:maxLines="1"
android:text="Day, Date"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:background="#color/black_5"
android:orientation="horizontal"
android:padding="#dimen/_8sdp">
<TextView
android:id="#+id/txtTanggal"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:gravity="center"
android:maxLines="1"
android:text="0"
android:textAllCaps="true"
android:textSize="#dimen/_7sdp" />
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/input_search"
android:layout_width="match_parent"
android:layout_height="#dimen/_25sdp"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/rectangle_input"
android:hint="Search Name Outlet"
android:inputType="text"
android:paddingHorizontal="#dimen/_10sdp"
android:textSize="#dimen/_7sdp" />
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:cardBackgroundColor="#color/blue_1"
app:cardCornerRadius="#dimen/_8sdp"
app:cardUseCompatPadding="true">
<androidx.appcompat.widget.LinearLayoutCompat
android:id="#+id/btnSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="#dimen/_8sdp">
<ImageView
android:layout_width="#dimen/_15sdp"
android:layout_height="#dimen/_15sdp"
android:src="#drawable/ic_search" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_20sdp"
android:background="#color/main_blue"
android:orientation="horizontal"
android:padding="#dimen/_4sdp">
<TextView
android:id="#+id/txtNo"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:gravity="center"
android:maxLines="1"
android:text="No"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp"
android:textStyle="normal" />
<TextView
android:id="#+id/txtQtyInbound"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:gravity="center"
android:maxLines="1"
android:text="Code"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
<TextView
android:id="#+id/txtDesc"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:gravity="center"
android:maxLines="1"
android:text="Store Name"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
<TextView
android:id="#+id/txtQtyScan"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:gravity="center"
android:maxLines="1"
android:text="Address"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
<TextView
android:id="#+id/txtSelect"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:gravity="center"
android:maxLines="1"
android:text="Select"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
</LinearLayout>
<cz.kinst.jakub.view.SimpleStatefulLayout
android:id="#+id/stateful"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/listPlanJourney"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:itemCount="4" />
</cz.kinst.jakub.view.SimpleStatefulLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
</ScrollView>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="#+id/llButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="#dimen/_8sdp"
android:layout_marginTop="#dimen/_16sdp"
android:layout_marginRight="#dimen/_8sdp"
android:layout_marginBottom="#dimen/_10sdp"
android:orientation="horizontal">
<Button
android:id="#+id/btnExit"
android:layout_width="match_parent"
android:layout_height="#dimen/_25sdp"
android:layout_weight="1"
android:background="#drawable/rectangle_button"
android:text="Exit"
android:textAllCaps="false"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
<Button
android:id="#+id/btnSubmit"
android:layout_width="match_parent"
android:layout_height="#dimen/_25sdp"
android:layout_marginLeft="#dimen/_4sdp"
android:layout_weight="1"
android:background="#drawable/rectangle_button"
android:text="Start Visit"
android:textAllCaps="false"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
</androidx.appcompat.widget.LinearLayoutCompat>
</RelativeLayout>
The RecyclerView may contains lots of items (say > 80), that why I put it inside a ScrollView. And I want the Buttons to stay permanent on the bottom of the screen, that's why I use android:layout_alignParentBottom="true". But when I run in, the result is not what I expect. Turns out the Buttons are actually "floating" on top of the ScrollView, like this:
What I want is the LinearLayout containing the Buttons stuck at the buttom, and the rest above it are fully occupied by the ScrollView. How to fix this?
I recommended you use ConstraintLayout and avoid nested layout as much as you can. I have modified your code as little as possible just to fit your needs like below(replace margin/padding back to your desire):
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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">
<LinearLayout
android:id="#+id/layout_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:src="#drawable/ic_notification" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:text="Paul Phoenix"
android:textColor="#0000FF"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:text="PX2350"
android:textColor="#0000FF"
android:textSize="10dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="#drawable/ic_notification" />
</LinearLayout>
<LinearLayout
android:id="#+id/layout_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="2dp"
android:background="#drawable/bg_pb"
android:orientation="vertical"
android:padding="16dp"
app:layout_constraintTop_toBottomOf="#id/layout_1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_marginTop="4dp"
android:background="#0000FF"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:gravity="center"
android:maxLines="1"
android:text="Day, Date"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="7dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:background="#000000"
android:orientation="horizontal"
android:padding="8dp">
<TextView
android:id="#+id/txtTanggal"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:gravity="center"
android:maxLines="1"
android:text="0"
android:textAllCaps="true"
android:textSize="7dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/layout_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="#id/layout_2">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/input_search"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/ic_notification"
android:hint="Search Name Outlet"
android:inputType="text"
android:paddingHorizontal="10dp"
android:textSize="7dp" />
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:cardBackgroundColor="#0000AA"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:id="#+id/btnSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="#drawable/ic_notification" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:id="#+id/layout_header"
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="#0000FF"
android:orientation="horizontal"
android:padding="4dp"
app:layout_constraintTop_toBottomOf="#id/layout_search">
<TextView
android:id="#+id/txtNo"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:gravity="center"
android:maxLines="1"
android:text="No"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="7dp"
android:textStyle="normal" />
<TextView
android:id="#+id/txtQtyInbound"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:gravity="center"
android:maxLines="1"
android:text="Code"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="7dp" />
<TextView
android:id="#+id/txtDesc"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:gravity="center"
android:maxLines="1"
android:text="Store Name"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="7dp" />
<TextView
android:id="#+id/txtQtyScan"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:gravity="center"
android:maxLines="1"
android:text="Address"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="7dp" />
<TextView
android:id="#+id/txtSelect"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:gravity="center"
android:maxLines="1"
android:text="Select"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="7dp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/listPlanJourney"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#id/llButtons"
app:layout_constraintTop_toBottomOf="#id/layout_header"
tools:itemCount="4" />
<LinearLayout
android:id="#+id/llButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent">
<Button
android:id="#+id/btnExit"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_weight="1"
android:background="#drawable/bg_pb"
android:text="Exit"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="7dp" />
<Button
android:id="#+id/btnSubmit"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginLeft="4dp"
android:layout_weight="1"
android:background="#drawable/bg_pb"
android:text="Start Visit"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="7dp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<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. :)
I have 3 linear Layouts with three objects each.What i want is to position (lets suppose) image view of third Linear layout with respect to the text view of first Linear layout.
IF the question seems silly,i apologies Being Naive to Android programming.
XML code here abot :
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/uppermainLinear">
<TextView
android:id="#+id/orderlistordernumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Order"
android:textColor="#android:color/black"
android:fontFamily="Ubuntu-B"
android:layout_marginLeft="#dimen/size_device_32"
android:layout_marginTop="#dimen/_10sdp"
android:layout_marginBottom="#dimen/_10sdp"
android:textSize="#dimen/_12sdp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="5"
android:paddingBottom="#dimen/_10sdp"
android:orientation="horizontal"
android:id="#+id/mainLinear"
android:layout_below="#+id/uppermainLinear">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="right"
android:layout_marginRight="#dimen/_5sdp"
android:layout_weight="0.4">
<ImageView
android:layout_width="wrap_content"
android:layout_height="#dimen/size_device_70"
android:adjustViewBounds="true"
android:layout_marginTop="#dimen/_2sdp"
android:id="#+id/ordelistbookingleftImage"
android:src="#drawable/tofrom" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2.2"
android:id="#+id/leftLinear"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="2"
android:id="#+id/orderleftSide">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginTop="#dimen/_2sdp"
android:id="#+id/ordelistfromLayout">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ordelistfromName"
android:textSize="#dimen/_11sdp"
android:textStyle="bold"
android:maxLines="1"
android:ellipsize="end"
android:fontFamily="Ubuntu-B"
android:text="mazz khan"
android:gravity="bottom"
android:textColor="#color/colorBlack" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ordelistfromNameDetail"
android:textSize="#dimen/_9sdp"
android:maxLines="1"
android:ellipsize="end"
android:textColor="#color/hint_text_color_two"
android:fontFamily="Ubuntu-B"
android:text="180-A new Muslim town Lahore"
android:layout_below="#+id/ordelistfromName" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginTop="23dp"
android:layout_marginRight="#dimen/_10sdp"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ordelisttoName"
android:textSize="#dimen/_11sdp"
android:textStyle="bold"
android:fontFamily="Ubuntu-B"
android:text="mazz khan"
android:maxLines="1"
android:ellipsize="end"
android:textColor="#color/colorBlack" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ordelisttoNameDetail"
android:textSize="#dimen/_9sdp"
android:fontFamily="Ubuntu-B"
android:textColor="#color/hint_text_color_two"
android:maxLines="1"
android:ellipsize="end"
android:text="180-A new Muslim town Lahore" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.2"
android:layout_marginLeft="#dimen/_2sdp"
android:id="#+id/rightLinear"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/date_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Date"
android:textSize="#dimen/_10sdp"
android:fontFamily="Ubuntu-R"
android:visibility="gone"
android:textColor="#color/colorBlack" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/amounttext"
android:textSize="#dimen/_10sdp"
android:fontFamily="Ubuntu-R"
android:layout_marginTop="#dimen/_3sdp"
android:textColor="#color/colorBlack"
android:text="Amount" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/Deliverytext"
android:textSize="#dimen/_10sdp"
android:singleLine="true"
android:fontFamily="Ubuntu-R"
android:layout_marginTop="#dimen/_3sdp"
android:textColor="#color/colorBlack"
android:text="Delivery Fee" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.8"
android:id="#+id/rightlinearForTrackingOrder"
android:orientation="vertical">
<TextView
android:id="#+id/ordelistDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="#dimen/_10sdp"
android:textColor="#color/summery_qar_text_color_black"
android:fontFamily="Ubuntu-L"
android:visibility="gone"
android:text="03-02-2017"/>
<TextView
android:id="#+id/ordelistamountvalue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="#dimen/_10sdp"
android:textColor="#color/summery_qar_text_color_black"
android:fontFamily="Ubuntu-L"
android:layout_marginTop="#dimen/_3sdp"
android:text="300 QR"/>
<TextView
android:id="#+id/ordelistdeliveryValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="#dimen/_10sdp"
android:fontFamily="Ubuntu-L"
android:text="20 QR"
android:textColor="#color/summery_qar_text_color_black"
android:layout_marginTop="#dimen/_3sdp" />
<ImageView
android:id="#+id/ordelistRightOptionImage"
android:layout_width="#dimen/_14sdp"
android:layout_height="#dimen/_14sdp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/_12sdp"
android:src="#drawable/edit" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/main_screen_line_divider"
android:layout_below="#+id/mainLinear"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginLeft="#dimen/_20sdp"
android:id="#+id/orderListRowBottomLine"
android:orientation="horizontal">
</View>
</RelativeLayout>
</FrameLayout>
<-these comment are useless to provide standard code description text->
The Tab Layout is overlapping with the status bar, I found a couple of threads having the same thing, but the solution seems to be adding "fitsSystemWindows" and I've already set it in my XML layout, the strange thing is I have more tabs like this and they seem to work perfectly.
This is my XML layout, any inputs would be helpful.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
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"
android:layout_margin="8dp"
android:fitsSystemWindows="true"
android:id="#id/root"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/linearLayout"
android:fitsSystemWindows="true"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="5dp" />
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:cardCornerRadius="5dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/ic_dashboard_bg"
android:scaleType="fitXY"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="10dp"
android:layout_gravity="center">
<ImageView
android:id="#+id/btnfilter"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="330dp"
android:src="#drawable/ic_filter" />
<TextView
android:id="#+id/title_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:text="6000"
android:textColor="#color/colorToday"
android:textSize="39dp" />
<ImageView
android:layout_width="32dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/title_amount"
android:layout_alignBottom="#id/title_amount"
android:layout_toLeftOf="#id/title_amount"
android:scaleType="fitXY"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:src="#drawable/ic_orange_big"
android:id="#+id/imageView9" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btnfilter"
android:layout_gravity="center"
android:layout_toEndOf="#+id/imageView9"
android:drawableTint="#color/colorPrimaryLight"
android:text="TODAY"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:textColor="#color/colorToday"
android:textSize="16sp"
android:textStyle="bold" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/title_amount_yesterday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableLeft="#drawable/ic_rupee_white"
android:drawableTint="#color/colorPrimaryLight"
android:text="5000"
android:textColor="#color/colorPrimaryLight"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/colorPrimaryLight"
android:text="Yesterday"
android:textSize="12sp"
android:layout_gravity="center"
android:textAllCaps="true"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/colorPrimaryLight"
android:text="Yesterday"
android:visibility="invisible"
android:layout_gravity="center"
android:textAllCaps="true"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/title_amount_persent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableLeft="#drawable/ic_percentage"
android:text="20%"
android:textColor="#color/colorGreen"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="percentage"
android:textAllCaps="true"
android:textColor="#color/colorGreen"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2"
android:orientation="horizontal">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginTop="8dp"
android:layout_height="wrap_content">
<TextView
android:id="#+id/center1"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:background="#color/colorDarkPink"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/center1"
android:orientation="vertical">
<TextView
android:id="#+id/week_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_rupee_black"
android:textSize="14sp"
android:textColor="#color/colorPrimaryText"
android:textStyle="bold"
android:paddingBottom="4dp"
android:text="25,000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10sp"
android:text="this week"
android:fontFamily="sans-serif-light"
android:textColor="#color/colorPrimaryText"
android:layout_gravity="center"
android:textAllCaps="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignParentRight="true"
android:layout_toRightOf="#+id/center1"
android:orientation="vertical">
<TextView
android:id="#+id/mtd_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_rupee_black"
android:textSize="14sp"
android:textColor="#color/colorPrimaryText"
android:textStyle="bold"
android:paddingBottom="4dp"
android:text="2.5 L"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10sp"
android:text="MTD"
android:fontFamily="sans-serif-light"
android:textColor="#color/colorPrimaryText"
android:layout_gravity="center"
android:textAllCaps="true"/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<ImageView
android:id="#+id/arrow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="0dp"
android:src="#drawable/ic_pink_transaction"/>
<TextView
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="#color/colorDarkPink"
/>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginTop="8dp"
android:layout_height="wrap_content">
<TextView
android:id="#+id/center2"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:background="#color/colorGreen"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/center2"
android:orientation="vertical">
<TextView
android:id="#+id/month_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_rupee_black"
android:textSize="14sp"
android:textColor="#color/colorPrimaryText"
android:textStyle="bold"
android:paddingBottom="4dp"
android:text="25,000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10sp"
android:text="this week"
android:fontFamily="sans-serif-light"
android:textColor="#color/colorPrimaryText"
android:layout_gravity="center"
android:textAllCaps="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignParentRight="true"
android:layout_toRightOf="#+id/center2"
android:orientation="vertical">
<TextView
android:id="#+id/avg_month_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_rupee_black"
android:textSize="14sp"
android:textColor="#color/colorPrimaryText"
android:textStyle="bold"
android:paddingBottom="4dp"
android:text="7,000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10sp"
android:text="Avg. Monthly"
android:fontFamily="sans-serif-light"
android:textColor="#color/colorPrimaryText"
android:layout_gravity="center"
android:textAllCaps="true"/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<ImageView
android:id="#+id/arrow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="0dp"
android:src="#drawable/ic_green_transaction"/>
<TextView
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="#color/colorGreen"
/>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
<include layout="#layout/barchart"></include>
<LinearLayout
android:id="#+id/performance_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:visibility="visible">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:layout_marginTop="16dp">
<include layout="#layout/performer_details"
android:fitsSystemWindows="true"></include>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:layout_marginTop="16dp">
<include layout="#layout/lest_performer_details"
android:fitsSystemWindows="true"></include>
</RelativeLayout>
</LinearLayout>
<include layout="#layout/piechart"></include>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
Add android:fitsSystemWindows to your LinearLayout to adjust view layout based on system windows such as the status bar. If true, adjusts the padding of this view to leave space for the system windows.
Will only take effect if this view is in a non-embedded activity.
Also you could try update your v21/styles.xml
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#color/colorPrimaryDark</item>
and make sure
<item name="android:windowTranslucentStatus">false</item>
If this won't resolve your issue, apply next line to the application theme:
<item name="android:fitsSystemWindows">true</item>
That's not recommended approach, but it would help you investigate problem.
If it's not root view, make sure android:fitsSystemWindows is true for the view that's located higher in hierarchy.
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();