I am working on a coordinator layout with a nested scroll view. I also have 3 buttons at the bottom of my screen in my layout. Now when I scroll the layout the last elements of my scroll view being overlapped with the buttons I put at the bottom. I tried using a relative layout as parent to get rid of this problem but it is still persisting. So how can I get rid of this problem?The layouts are given below:
activity_agent_profile_2:
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
tools:context=".AgentProfileActivity2">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:fitsSystemWindows="true"
android:layout_above="#+id/laytbtns">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="270dp"
android:fitsSystemWindows="true"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/agent_profile_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginBottom="125dp"
app:expandedTitleMarginStart="118dp"
app:expandedTitleTextAppearance="#style/expandedappbar"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax">
<ImageView
android:id="#+id/backdrop"
android:layout_width="match_parent"
android:layout_height="180dp"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:src="#drawable/back" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="180dp"
android:background="#66000000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="120dp"
android:orientation="vertical">
<TextView
android:id="#+id/lbl_agent_profile_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/lbl_agent_profile_Name"
android:ellipsize="end"
android:maxLines="1"
android:text="Real Estate Professional at Exit Alliance Realty"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#fff"
android:textSize="12sp"
android:typeface="sans" />
<TextView
android:id="#+id/lbl_agent_profile_membersince"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Member Since: 2015"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#fff"
android:textSize="13sp"
android:typeface="sans" />
</LinearLayout>
</RelativeLayout>
<ImageView
android:id="#+id/img_agent_profile_image"
android:layout_width="100dp"
android:layout_height="140dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:scaleType="fitStart"
android:src="#drawable/no_profile" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/backdrop"
android:layout_marginLeft="5dp"
android:layout_toEndOf="#+id/img_agent_profile_image"
android:layout_toRightOf="#+id/img_agent_profile_image"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/relativeLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff">
<ImageView
android:id="#+id/imageView13"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_phone_img" />
<TextView
android:id="#+id/lbl_agent_profile_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:layout_toEndOf="#+id/imageView13"
android:layout_toRightOf="#+id/imageView13"
android:text="01723735134"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#56698F"
android:textSize="13sp"
android:typeface="sans" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff">
<ImageView
android:id="#+id/imageView14"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_location_nopadding" />
<TextView
android:id="#+id/lbl_agent_profile_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:layout_toEndOf="#+id/imageView14"
android:layout_toRightOf="#+id/imageView14"
android:ellipsize="end"
android:maxLines="1"
android:text="2868 Al Urabuh Road, Al Urudh, Ryadh"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#56698F"
android:textSize="12sp"
android:typeface="sans" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayout5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff">
<ImageView
android:id="#+id/imageView15"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_website" />
<TextView
android:id="#+id/lbl_agent_profile_website"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:layout_toEndOf="#+id/imageView15"
android:layout_toRightOf="#+id/imageView15"
android:ellipsize="end"
android:maxLines="1"
android:text="www.ibaax.com"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#56698F"
android:textSize="12sp"
android:typeface="sans" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_marginTop="-50dp"
app:layout_collapseMode="pin"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_agent_profile" />
</android.support.design.widget.CoordinatorLayout>
<LinearLayout
android:id="#+id/laytbtns"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="#495B81">
<Button
android:id="#+id/testbutton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#56688f"
android:onClick="btnEmail_click"
android:text="Message"
android:textColor="#fff"
android:textStyle="bold"
android:typeface="sans" />
<Button
android:id="#+id/SMSButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#56688f"
android:onClick="btnSMS_click"
android:text="SMS"
android:textColor="#fff"
android:textStyle="bold"
android:typeface="sans" />
<Button
android:id="#+id/cancelButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#56688f"
android:onClick="btnPhone_click"
android:text="Call"
android:textColor="#fff"
android:textStyle="bold"
android:typeface="sans" />
</LinearLayout></RelativeLayout>
content_agent_profile.xml:
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:layout_gravity="fill_vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context=".AgentProfileActivity2"
tools:showIn="#layout/activity_agent_profile2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="5dp"
android:background="#d3d3d3" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="Specialities"
android:textColor="#60aaff"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/lbl_agent_profile_specialites"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="5dp"
android:background="#d3d3d3" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="Service Area"
android:textColor="#60aaff"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/lbl_agent_profile_service"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="5dp"
android:background="#d3d3d3" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="Profile Summery "
android:textColor="#60aaff"
android:textSize="18sp"
android:textStyle="bold" />
<WebView
android:id="#+id/web_agentprofile_description"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="5dp"
android:background="#d3d3d3" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="Active Listing"
android:textColor="#60aaff"
android:textSize="18sp"
android:textStyle="bold" />
<UI.ExpandableHeightGridView
android:id="#+id/gridview_agent_property"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:horizontalSpacing="2dp"
android:isScrollContainer="false"
android:numColumns="1"
android:stretchMode="columnWidth"
android:verticalSpacing="2dp" />
</LinearLayout>
</LinearLayout></android.support.v4.widget.NestedScrollView>
Here is an image of the issue:
Contents in scroll view is being overlapped
Edit:
So I fixed the issue by setting a margin-bottom to 80dp in my nested scroll view. It seems to work for now but it is not a permanent solution. If anyone can come up with a better solution, I will be really grateful.
<include layout="#layout/content_agent_profile"
android:layout_above="#+id/your above layout id"
android:layout_below="#+id/below layout id"/>
So I fixed the issue by setting a margin-bottom to 80dp in my nested scroll view. It seems to work for now but it is not a permanent solution. If anyone can come up with a better solution, I will be really grateful.
If you're using ConstraintLayout and your included layout overlapping other views, then give your include layout height and width.
<include
android:id="#+id/errorScreen"
layout="#layout/error_screen_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/topView"/>
Related
I have a situation where linearlayout doesn't stay fixed at the bottom of the co-ordinatorlayout but moves with respect to the scrollview contents above.
I have tried all solutions on StackOverflow but still no luck (ex:Keep LinearLayout at the bottom of screen and even tried relativelayout but no luck: Make a RelativeLayout at the bottom of a Scrollview ). I am not sure what could be causing this, for the linear/relativelayout to move with respect to the scrollview, but if anyone else can figure out what I am doing wrong or missing, that'll be a great help!
Thanks in advance! Here's my XML code below: (open to sharing any other relevant java code if that helps )
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
android:clickable="false"
android:fitsSystemWindows="true"
android:fillViewport="true"
android:id="#+id/cl_root_view"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/main_register_container"
android:layout_marginBottom="60dp"
android:background="#color/white"
android:orientation="vertical">
<LinearLayout
android:id="#+id/activity_register_guest"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
app:subtitleTextColor="#color/white"
app:titleTextAppearance="#style/Toolbar.TitleText"
app:titleTextColor="#color/white">
<!--<TextView
android:id="#+id/nav_back_btn"
style="#style/Body1RegLeftBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/activity_horizontal_margin"
android:layout_marginTop="20dp"
android:background="#drawable/ic_backarrow"
android:gravity="center_horizontal" />-->
<TextView
android:id="#+id/register_guest_main_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="15dp"
android:layout_gravity="center"
android:letterSpacing="0.01"
android:textAllCaps="true"
android:text="#string/register_guest"
android:textAppearance="#style/TextAppearance.Text.Roboto.Medium"
android:textColor="#de000000"
android:textSize="17sp"
android:textStyle="normal"
/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:background="#color/white"
android:fitsSystemWindows="true"
android:layout_marginBottom="65dp">
<RelativeLayout
android:id="#+id/register_visitor_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:clickable="false"
android:fillViewport="true">
<LinearLayout
android:id="#+id/main_register_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<TextView
android:id="#+id/my_location"
style="#style/Headline2LeftBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/activity_horizontal_margin"
android:textAppearance="#style/TextAppearance.Text.Chronicle"
android:textSize="28sp"
tools:text="#string/five_thirty_fifth_ave" />
<TextView
style="#style/Body1RegRightRed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/my_location"
android:layout_alignParentEnd="true"
android:layout_marginEnd="#dimen/activity_horizontal_margin"
android:layout_toEndOf="#+id/my_location"
android:text="#string/location_change"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular"
android:visibility="gone" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="28dp"
android:layout_marginTop="24dp"
android:gravity="center_vertical"
android:layout_marginBottom="8dp"
android:weightSum="2">
<TextView
android:id="#+id/select_date_and_time"
android:layout_width="wrap_content"
android:textSize="17sp"
android:lineSpacingExtra="6sp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:textColor="#color/black"
android:text="#string/select_date_and_time"
android:textAppearance="#style/TextAppearance.Text.Roboto.Medium" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="#color/registerUserSeparatorColor" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
android:weightSum="2">
<TextView
android:id="#+id/register_guest_start_date"
style="#style/Body1RegLeftBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:text="#string/register_guest_start_date"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular" />
<TextView
android:id="#+id/register_guest_start_time"
style="#style/Body1RegRightBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:text="#string/register_guest_start_time"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="#color/registerUserSeparatorColor" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
android:weightSum="2">
<TextView
android:id="#+id/register_guest_end_date"
style="#style/Body1RegLeftBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:text="#string/register_guest_end_date"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular"
android:visibility="invisible" />
<TextView
android:id="#+id/register_guest_end_time"
style="#style/Body1RegRightBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:text="#string/register_guest_end_time"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="#color/registerUserSeparatorColor" />
<TextView
android:id="#+id/build_your_guest_list"
android:layout_width="wrap_content"
android:textSize="17sp"
android:layout_marginTop="42dp"
android:lineSpacingExtra="6sp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:textColor="#color/black"
android:text="#string/build_your_guest_list"
android:paddingBottom="8dp"
android:textAppearance="#style/TextAppearance.Text.Roboto.Medium" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="#color/registerUserSeparatorColor" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="44dp"
android:id="#+id/add_guest"
android:layout_marginTop="3dp"
android:layout_marginBottom="8dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="44dp"
android:lineHeight="22sp"
android:drawablePadding="10dp"
android:drawableStart="#drawable/ic_add_24px"
android:drawableTint="#color/bluish"
android:layout_marginStart="17dp"
android:lineSpacingExtra="6sp"
android:textColor="#color/bluish"
android:gravity="center_vertical"
android:textAppearance="#style/TextAppearance.Text.Roboto.Medium"
android:text="#string/add_a_new_guest"
android:textSize="17sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="#color/registerUserSeparatorColor"
/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="44dp"
android:id="#+id/search_guest"
android:layout_marginTop="3dp"
android:visibility="gone"
android:layout_marginBottom="8dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="44dp"
android:lineHeight="22sp"
android:drawablePadding="10dp"
android:drawableStart="#drawable/ic_search_24px"
android:drawableTint="#color/bluish"
android:layout_marginStart="17dp"
android:lineSpacingExtra="6sp"
android:textColor="#color/bluish"
android:gravity="center_vertical"
android:textAppearance="#style/TextAppearance.Text.Roboto.Medium"
android:text="#string/search_past_guests"
android:textSize="17sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:visibility="gone"
android:id="#+id/search_guest_line"
android:background="#color/registerUserSeparatorColor"
/>
<android.support.v7.widget.RecyclerView
android:id="#+id/guest_item_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#null"
android:overScrollMode="never"
tools:listitem="#layout/item_guest" />
<TextView
android:id="#+id/arrival_notifications"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="58dp"
android:letterSpacing="0.01"
android:lineSpacingExtra="4sp"
android:text="#string/arrival_notifications"
android:textAppearance="#style/TextAppearance.Text.Roboto.Medium"
android:textColor="#color/black"
android:textSize="20sp"
android:textStyle="normal"
android:visibility="invisible" />
<RelativeLayout
android:id="#+id/text_message_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:visibility="gone">
<TextView
android:id="#+id/text_message"
style="#style/Body1RegLeftBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="11dp"
android:text="#string/text_message"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular" />
<TextView
android:id="#+id/tap_phone_number_text"
style="#style/Body2RegLeftGrey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/text_message"
android:layout_marginTop="2dp"
android:text="#string/tap_to_add_a_phone_number"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular" />
<android.support.v7.widget.SwitchCompat
android:id="#+id/text_message_switch"
style="#style/Color1SwitchStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginTop="11dp"
android:background="#color/settingsSeparatorLineColor"
android:visibility="gone" />
</LinearLayout>
<!-- <TextView
android:id="#+id/submit_users_btn"
style="#style/LoginButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|bottom"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:paddingBottom="30dp"
android:letterSpacing="0.07"
android:lineSpacingExtra="0sp"
android:text="#string/submit_visitor_list"
android:textAppearance="#style/TextAppearance.Text.Roboto.Medium"
android:textSize="16sp"
android:textStyle="normal" /> -->
</RelativeLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_gravity="center|bottom"
android:background="#color/transparent"
android:layout_marginBottom="75dp"
android:orientation="vertical"
android:id="#+id/fixedSubmitButtonlayout">
<TextView
android:id="#+id/submit_users_btn"
android:textColor="#757575"
android:textAlignment="center"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#drawable/textview_border"
android:letterSpacing="0.07"
android:gravity="center"
android:lineSpacingExtra="0sp"
android:text="#string/register_guest_caps"
android:textAppearance="#style/TextAppearance.Text.RidleyGrotesk.Regular"
android:textSize="16sp"
android:textStyle="normal" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
From the code above, the layout I am trying to fix at the bottom has id is: android:id="#+id/fixedSubmitButtonlayout".
I want it to stay intact/fixed at the bottom of the screen irrespective of the scrollview above it which is supposed to scroll behind it ( it does as of now, just the button position changes as the scroll view content overflows screen size). any ideas on how to fix this?
Just need to do this steps:
add a RelativeLayout as a Parent of CoordinatorLayout and
take out the last LinearLayout from CoordinatorLayout and
add it to RelativeLayout with android:layout_alignParentBottom="true".
note that you need to add android:layout_marginBottom="40dp" to your CoordinatorLayout
You can try this (tested and it works fine):
<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"
>
<your CoordinatorLayout>
</your CoordinatorLayout>
<LinearLayout
android:id="#+id/fixedSubmitButtonlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_gravity="center|bottom"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="#color/transparent"
android:orientation="vertical"
>
<TextView
android:id="#+id/submit_users_btn"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#drawable/textview_border"
android:gravity="center"
android:letterSpacing="0.07"
android:lineSpacingExtra="0sp"
android:text="#string/register_guest_caps"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.Text.RidleyGrotesk.Regular"
android:textColor="#757575"
android:textSize="16sp"
android:textStyle="normal"
/>
</LinearLayout>
</RelativeLayout>
It will work better in Relative layout
android:layout_alignParentBottom="true"
In your CoordinatorLayout, your View must be a direct child and not a child of another View inside the CoordinatorLayout. Then you can add this line of code to it:
android:layout_gravity="bottom"
The structure can be like this:
- CoordinatorLayout //(Parent View)
- - AppBarLayout //(Child View - Toolbar)
- - NestedScrollView //(Child View - Scrollable Content)
- - LinearLayout //(Child View - Bottom Fixed Content)
Here's a Sample code how it's supposed to be:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/black_overlay"
android:theme="#style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="#style/Toolbar.Light"
app:contentInsetStartWithNavigation="0dp"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!--Your Scrollable Content Goes Here-->
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical">
<!--Your Fixed Bottom Content Goes Here-->
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
I have a pretty strange issue. So, I have a base tab layout which helps navigation between different activities and fragment. However, some of the layouts (esp fragment layouts) seem to be cut off exposing activities in the background.
Any idea why it could be doing this?
Here's the code for the fragment layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/settingsSeparatorColor"
android:clickable="true"
android:focusable="true"
android:fitsSystemWindows="true"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/white">
<ImageButton
android:id="#+id/nav_back_btn"
style="#style/Button.ImageButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_marginStart="#dimen/activity_horizontal_margin"
android:background="#color/transparent"
android:contentDescription="#string/back"
android:tint="#color/black"
app:srcCompat="#drawable/ic_close" />
<TextView
android:id="#+id/profile_edit_button"
style="#style/Body1RegRightBlack"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="#string/profile_edit"
android:gravity="center_vertical"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/profile_pic_container"
layout="#layout/item_profile_pic" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="12dp">
<TextView
android:id="#+id/fullName"
style="#style/Headline3CenterBlack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:textAppearance="#style/TextAppearance.Text.Chronicle"
tools:text="Angela Heely" />
<TextView
android:id="#+id/companyName"
style="#style/Body2RegCenterGrey"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/fullName"
android:background="#android:color/transparent"
android:paddingTop="12dp"
android:singleLine="true"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular"
android:textSize="16sp"
tools:text="Cardinal Dev Agency" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="32dp"
android:gravity="center_vertical"
android:weightSum="2">
<TextView
style="#style/Body1RegLeftBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:text="#string/home_location"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular" />
<TextView
android:id="#+id/home_location"
style="#style/Body1RegRightGrey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular"
tools:text="My Home location" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:background="#color/settingsSeparatorColor"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
android:visibility="gone"
android:weightSum="2">
<TextView
style="#style/Body1RegLeftBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:text="#string/push_notifications"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular" />
<android.support.v7.widget.SwitchCompat
android:id="#+id/push_notification_switch"
style="#style/Color1SwitchStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_weight="1" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/settingsSeparatorColor" />
<include layout="#layout/item_settings_separator" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:id="#+id/reset_password"
style="#style/Body1RegLeftBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:text="#string/reset_password"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular" />
<ImageView
android:id="#+id/reset_password_chevron"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:background="#drawable/ic_baseline_chevron_right_24px"
android:contentDescription="#null"
android:gravity="end"
android:backgroundTint="#color/brownish_grey" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:background="#color/settingsSeparatorColor" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
android:weightSum="1">
<TextView
android:id="#+id/legal_terms"
style="#style/Body1RegLeftBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:text="#string/eula"
android:textAppearance="#style/TextAppearance.Text.Roboto.Regular" />
<ImageView
android:id="#+id/legal_terms_chevron"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:background="#drawable/ic_baseline_chevron_right_24px"
android:contentDescription="#null"
android:gravity="end"
android:backgroundTint="#color/brownish_grey" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/settingsSeparatorColor" />
<include layout="#layout/item_settings_separator" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:background="#color/settingsSeparatorColor"
android:visibility="gone" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical">
<TextView
android:id="#+id/optionLogout"
style="#style/Body1RegCenterRed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:text="#string/sign_out" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:background="#color/transparent"
android:fitsSystemWindows="true"
android:gravity="bottom|center_horizontal">
<TextView
android:id="#+id/optionVersion"
style="#style/Caption1RegCenterGrey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Build v. 0.0.1" />
</RelativeLayout>
</LinearLayout>
Here's the code for the tab base container layout: (Please note the actual screen content is displayed in the linearlayout titled : dynamicContent below)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#color/white"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#color/white"
android:id="#+id/bottomNavBar"
android:orientation="horizontal"
android:fitsSystemWindows="true"
android:foregroundGravity="bottom"
android:translationZ="60dp"
android:layout_alignParentBottom="true"
>
<RadioGroup
android:id="#+id/radioGroup1"
android:gravity="center"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="horizontal"
>
<RadioButton
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent"
android:text="Matching"
android:layout_weight="1"
android:button="#null"
android:padding="2dp"
android:checked="false"
android:textSize="12sp"
android:drawableTop="#drawable/ic_baseline_chevron_right_24px"
android:textColor="#color/black"
android:id="#+id/matching"/>
<RadioButton
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent"
android:button="#null"
android:layout_weight="1"
android:padding="2dp"
android:checked="false"
android:textSize="12sp"
android:drawableTop="#drawable/ic_baseline_chevron_right_24px"
android:textColor="#color/black"
android:id="#+id/watchList"
android:text="Watchlist"/>
<RadioButton
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent"
android:id="#+id/rates"
android:button="#null"
android:paddingTop="5dp"
android:paddingBottom="2dp"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:layout_weight="1"
android:checked="false"
android:textSize="12sp"
android:drawableTop="#drawable/ic_baseline_chevron_right_24px"
android:textColor="#color/black"
android:text="Rates"/>
<RadioButton
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent"
android:button="#null"
android:padding="2dp"
android:checked="false"
android:layout_weight="1"
android:textSize="12sp"
android:drawableTop="#drawable/ic_baseline_chevron_right_24px"
android:textColor="#color/black"
android:id="#+id/deals"
android:text="Deals"/>
<RadioButton
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent"
android:button="#null"
android:padding="2dp"
android:checked="false"
android:layout_weight="1"
android:textSize="12sp"
android:drawableTop="#drawable/ic_baseline_chevron_right_24px"
android:textColor="#color/black"
android:id="#+id/listing"
android:text="Listing"/>
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/dynamicContent"
android:background="#color/white"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:layout_alignParentTop="true"
/>
</RelativeLayout>
I tried many options including fitsystemwindows, commenting out scrollview and other solutions suggested on stackoverflow, but not luck. Any ideas how to go about this one?
Thanks!
Add: android:fillViewport="true" in the scrollview
I have been trying to use RelativeLayout in ScrollView to positioning two LinearLayouts, one to top and one to center. I've used layout_alignParentTop and layout_centerVertical. To prevent overlapping I've tried to use layout_below on second LinearLayout but it breaks layout_centerVertical and the second LinearLayout goes to top. How to do it? Thanks.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:fillViewport="true"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".activities.StartFragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/trial_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="25dp"
android:layout_alignParentTop="true"
android:background="#drawable/trial_border"
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="top"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_marginLeft="10dp"
android:src="#drawable/ic_access_time_black_24dp" />
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:orientation="vertical">
<TextView
android:id="#+id/trial_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center"
android:text="#string/trial_exp"
android:textColor="#color/darkGrey"
android:textSize="15sp" />
<TextView
android:id="#+id/trial_more"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="right|center"
android:text="#string/trial_exp_more"
android:textColor="#color/darkGreen"
android:layout_marginRight="10dp"
android:textSize="13sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/main_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/trial_button"
android:layout_centerVertical="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/VImage"
android:layout_width="wrap_content"
android:layout_height="200sp"
android:src="#drawable/image_global" />
<TextView
android:id="#+id/VText"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:text="#string/protection_disabled"
android:textColor="#color/darkRed"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:gravity="center"
android:orientation="vertical">
<com.google.android.material.button.MaterialButton
android:id="#+id/start_vpn_button"
style="#style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="141dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="#string/protect_me"
android:textColor="#color/white"
android:textStyle="bold"
app:backgroundTint="#color/green" />
<com.google.android.material.button.MaterialButton
android:id="#+id/stop_vpn_button"
style="#style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="141dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="#string/unprotect_me"
android:textColor="#color/white"
android:textStyle="bold"
android:visibility="gone"
app:backgroundTint="#color/red" />
</LinearLayout>
<LinearLayout
android:id="#+id/r_button"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="50sp"
android:layout_marginRight="20dp"
android:background="#drawable/single_border"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
android:orientation="horizontal">
<ImageView
android:id="#+id/r_image"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="#drawable/image_r_50" />
<TextView
android:id="#+id/r_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center"
android:text="#string/r_to"
android:textColor="#color/darkGrey"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
I have a code here which contains of a coordinator layout. Inside that coordinator layout, there is an appbar layout and a nested scrollview beneath it.I want the appbar layout(map) to be still even when nestedscroll view scrolls.I have images to explain my thoughts. Initial stage, stage two. Notice that the map remains still while only nested scroll view scrolls and finally, nested scroll view overlaps entire map fragment.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#android:color/white">
<android.support.design.widget.AppBarLayout
android:id="#+id/MyAppbar"
android:layout_width="match_parent"
android:layout_height="550dp"
android:fitsSystemWindows="true"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapse_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true">
<android.support.v7.widget.Toolbar
android:id="#+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="60dp"
app:layout_collapseMode="pin"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/close_button"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_centerVertical="true"
android:src="#drawable/close_black"
/>
<TextView
android:id="#+id/shipping_to_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SHIPPING TO"
android:textColor="#color/black"
android:textStyle="bold"
android:textSize="10dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"/>
<TextView
android:id="#+id/shipping_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="926 Rosenbaum Mill"
android:textColor="#color/black"
android:layout_below="#id/shipping_to_title"
android:textSize="16dp"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="550dp"
tools:context=".MapFragment"
android:layout_below="#id/my_toolbar"
app:layout_collapseMode="pin"
>
<RelativeLayout
android:id="#+id/outermost_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:id="#+id/bottom_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_centerHorizontal="true"
>
<include
android:id="#+id/getDirections"
layout="#layout/track_shipment_activity_get_directions_fragment_layout"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
/>
<include
android:id="#+id/received"
layout="#layout/track_shipment_activity_received_fragment_layout"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
/>
<include
android:id="#+id/enrouteToDestination"
layout="#layout/track_shipment_activity_button_fragment_layout"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
/>
<include
android:id="#+id/trackOrder"
layout="#layout/track_shipment_track_order_button_fragment_layout"
android:visibility="gone"
/>
<RelativeLayout
android:id="#+id/trackOrderBelow"
android:layout_width="300dp"
android:layout_height="40dp"
android:layout_below="#id/trackOrder"
android:layout_marginBottom="20dp"
android:background="#FBFBFB"
android:layout_centerHorizontal="true"
android:visibility="gone">
<TextView
android:id="#+id/tracking_code_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/tracking_code"
android:textSize="14dp"
android:textColor="#color/black"
android:layout_marginStart="10dp"
android:layout_centerVertical="true"/>
<TextView
android:id="#+id/tracking_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/tracking_code_numbers"
android:layout_toRightOf="#id/tracking_code_title"
android:textSize="14dp"
android:textColor="#color/black"
android:layout_marginStart="10dp"
android:layout_centerVertical="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/double_boxes"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_centerVertical="true"/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</fragment>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView 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:layout_gravity="fill_vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/abc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/MyAppbar"
android:layout_marginTop="30dp"
tools:context=".MapFragment">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ScrollView
android:id="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/relative_layout_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/activity_background">
<RelativeLayout
android:id="#+id/relative_layout_inner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:focusedByDefault="true">
<ImageView
android:id="#+id/order_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="15dp"
android:layout_marginTop="25dp"
android:contentDescription="#string/app_name"
android:src="#drawable/orders" />
<TextView
android:id="#+id/order_date_title"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginTop="25dp"
android:layout_toEndOf="#id/order_icon"
android:gravity="center"
android:paddingLeft="5dp"
android:text="#string/order_date2"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/order_date"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="15dp"
android:layout_marginTop="25dp"
android:layout_toEndOf="#id/order_date_title"
android:gravity="center|end"
android:paddingLeft="90dp"
android:text="#string/date5"
android:textColor="#android:color/black"
android:textStyle="bold" />
<ImageView
android:id="#+id/placeBy_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#id/order_icon"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:contentDescription="#string/app_name"
android:src="#drawable/person" />
<TextView
android:id="#+id/placed_by_title"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/order_date_title"
android:layout_marginTop="20dp"
android:layout_toEndOf="#id/placeBy_icon"
android:gravity="center"
android:paddingLeft="5dp"
android:text="#string/placed_by"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/placed_by"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_below="#id/order_date_title"
android:layout_marginEnd="15dp"
android:layout_marginTop="20dp"
android:layout_toEndOf="#id/placed_by_title"
android:gravity="center|end"
android:paddingLeft="100dp"
android:text="#string/user_name"
android:textColor="#android:color/black"
android:textStyle="bold" />
<ImageView
android:id="#+id/delivery_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#id/placeBy_icon"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:contentDescription="#string/app_name"
android:src="#drawable/delivery" />
<TextView
android:id="#+id/delivery_method_title"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/placed_by_title"
android:layout_marginTop="20dp"
android:layout_toEndOf="#id/delivery_icon"
android:gravity="center"
android:paddingLeft="5dp"
android:text="#string/delivery_method"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/delivery_method"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_below="#id/placed_by_title"
android:layout_marginEnd="15dp"
android:layout_marginTop="20dp"
android:layout_toEndOf="#id/delivery_method_title"
android:gravity="center|end"
android:text="#string/shipping"
android:textColor="#android:color/black"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/add_to_calander_button_shipment"
android:layout_width="340dp"
android:layout_height="40dp"
android:layout_below="#+id/delivery_icon"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:background="#drawable/add_to_calander">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true">
<ImageView
android:id="#+id/addToCalIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/app_name"
android:src="#drawable/orders" />
<TextView
android:id="#+id/addToCalText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="2dp"
android:layout_toEndOf="#id/addToCalIcon"
android:text="#string/add_to_calander"
android:textSize="14dp" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
<View
android:id="#+id/threeItems"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="#+id/relative_layout_inner"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:background="#color/activity_background" />
<TextView
android:id="#+id/threeItemstext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relative_layout_inner"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:text="#string/number_of_items"
android:textColor="#color/black"
android:textSize="16dp"
android:textStyle="bold" />
<android.support.v4.widget.NestedScrollView
android:id="#+id/nestedRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/threeItems">
<android.support.v7.widget.RecyclerView
android:id="#+id/simpleRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
android:nestedScrollingEnabled="false"
app:layout_behavior="#string/app_bar_scrolling_view_behavior">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.NestedScrollView>
<include
android:id="#+id/delivery_details"
layout="#layout/track_shipment_delivery_details_fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/nestedRecyclerView"
android:layout_marginBottom="5dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp" />
<include
android:id="#+id/order"
layout="#layout/track_shipment_order_total_fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/delivery_details"
android:layout_marginBottom="5dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp" />
<include
android:id="#+id/need_help"
layout="#layout/track_shipment_need_help_fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/order"
android:layout_marginBottom="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Try adding
app:behavior_overlapTop="0dp" in your nested scroll view and also add some elevation to the nested scroll view.
I want to design the screen. layout, tab and grid view I want to scroll option. In scroll time, fix the tab on the header (Below of status bar) and grid view scroll to end of grid view content. In the bottom, I fixed bottom navigation bar.
This is my xml code:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
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/layout_background"
android:fillViewport="true"
android:scrollbars="none">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/rlay_home_page_Tap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/rlay_home_page_Tap1"
android:background="#color/layout_background">
<RelativeLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="185dp"
android:background="#drawable/main_header_selector"
android:gravity="bottom|center">
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/llay_home_bottom2"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_toEndOf="#+id/llay_home_bottom2" />
<TextView
android:id="#+id/textView10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/profile_image"
android:layout_marginTop="10dp"
android:layout_toEndOf="#+id/img_fb_dp"
android:layout_weight="1"
android:gravity="center"
android:text=""
android:textColor="#000"
android:textSize="16dp" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/profile_image"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:layout_marginTop="24dp"
android:src="#drawable/ic_profile" />
<TextView
android:id="#+id/amsc_txt_home_fbusername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/textView10"
android:gravity="center"
android:textColor="#fff"
android:textSize="16dp" />
<TextView
android:id="#+id/amsc_txt_home_All_ImgCount"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_above="#+id/textView10"
android:layout_marginBottom="60dp"
android:layout_marginStart="20dp"
android:gravity="center"
android:text="125 \nPhotos"
android:textColor="#fff"
android:textSize="12dp" />
<TextView
android:id="#+id/amsc_txt_home_Fav_ImgCount"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_above="#+id/textView10"
android:layout_alignParentEnd="true"
android:layout_marginBottom="60dp"
android:layout_marginEnd="20dp"
android:gravity="center"
android:text="125 \nFavouite"
android:textColor="#fff"
android:textSize="12dp" />
</RelativeLayout>
<android.support.design.widget.TabLayout
android:id="#+id/simpleTabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout"
android:gravity="center"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabSelectedTextColor="#color/tab_select_color"
app:tabTextColor="#color/black_text_color" />
<RelativeLayout
android:id="#+id/llay_home_grd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/simpleTabLayout"
android:layout_above="#+id/linearLayout8"
android:background="#color/layout_background"
android:orientation="vertical">
<GridView
android:id="#+id/grid_test1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginStart="2dp"
android:background="#color/layout_background"
android:horizontalSpacing="2dp"
android:numColumns="3"
android:verticalSpacing="2dp" />
>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/linearLayout8"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:background="#android:color/white"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/linearLayout6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:background="#android:color/white"
android:orientation="horizontal">
<android.support.design.widget.BottomNavigationView
android:id="#+id/bottom_navigation_home1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:background="#color/wight"
app:itemIconTint="#drawable/bottom_navigation_color_selector"
app:itemTextColor="#drawable/bottom_navigation_color_selector"
app:menu="#menu/my_navigation_home" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:background="#android:color/white"
android:orientation="horizontal"
android:visibility="gone">
<android.support.design.widget.BottomNavigationView
android:id="#+id/bottom_navigation_home2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:background="#color/wight"
app:itemIconTint="#drawable/bottom_navigation_color_selector2"
app:itemTextColor="#drawable/bottom_navigation_color_selector2"
app:menu="#menu/my_navigation_home2" />
</LinearLayout>
</RelativeLayout>
<ImageView
android:id="#+id/img_take_cam_but"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:onClick=""
android:background="#drawable/ic_capture"/>
</RelativeLayout>
</FrameLayout>
Above code , gridview only scrolling.How to scroll image type.
use appbarlayout and drawer layout for doing the tab part
<android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.AppBarLayout>
<android.support.v7.widget.Toolbar/>
<android.support.design.widget.TabLayout/>
</android.support.design.widget.AppBarLayout>
<!---your--layout--here--->
</android.support.design.widget.CoordinatorLayout>