Scrollview -> Relativelayout -> TabLayout don't scroll whole layout - android

I am Trying to scroll whole layout but I can't, only tablayout scroll and relative layout above the tablayout they can't scroll, how to fix it, I am trying to make like instagram profile or account fragment page... help to fix it... thanks in advance and I am using under tablayout framelayout not a viewpager and attach with framelayout fragment the 1st tab I can click then that fragment use the scroll, linear and the recyclerview that fragment call then whole layout scroll, but another second tab I can click then that fragment use the linear and gridview only and that fragment call then half layout scroll, where I am wrong please tell me...
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:id="#+id/relativelayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/imglayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/cvprofile"
android:layout_width="86dp"
android:layout_height="86dp"
app:civ_border_color="#a4a4a4"
app:civ_border_width="0.5dp"
android:layout_margin="12dp"
android:src="#drawable/img" />
</LinearLayout>
<LinearLayout
android:id="#+id/digitlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/imglayout"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="12dp">
<TextView
android:id="#+id/post"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="100"
android:gravity="center"
android:textColor="#color/black"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/followers"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="100"
android:gravity="center"
android:textColor="#color/black"
android:textSize="16sp"
android:textStyle="bold"/>
<TextView
android:id="#+id/following"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="43"
android:gravity="center"
android:textColor="#color/black"
android:textSize="16sp"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:id="#+id/textlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/imglayout"
android:layout_below="#id/digitlayout"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="2dp">
<TextView
android:id="#+id/posts"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="posts"
android:gravity="center"
android:textSize="16sp" />
<TextView
android:id="#+id/followerss"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="follwers"
android:textSize="16sp"
android:gravity="center"/>
<TextView
android:id="#+id/followings"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="follwers"
android:textSize="16sp"
android:gravity="center"/>
</LinearLayout>
<TextView
android:id="#+id/tvedit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/edit_profile"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="10dp"
android:textSize="15sp"
android:textStyle="bold"
android:textColor="#color/black"
android:background="#drawable/bg_textview"
android:layout_toRightOf="#id/imglayout"
android:layout_below="#id/textlayout"
android:gravity="center_horizontal"/>
<View
android:id="#+id/view1"
android:layout_below="#id/imglayout"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="#b6b6b6" />
<android.support.design.widget.TabLayout
android:id="#+id/tabLayout"
android:layout_below="#id/view1"
app:tabIndicatorHeight="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabMode="fixed">
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="#drawable/frame1"/>
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="#drawable/frame1" />
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="#drawable/frame1" />
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="#drawable/frame1" />
</android.support.design.widget.TabLayout>
<View
android:id="#+id/view2"
android:layout_below="#id/tabLayout"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="#b6b6b6" />
<FrameLayout
android:id="#+id/framelayout"
android:layout_below="#id/view2"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
</RelativeLayout>
</ScrollView>

Try changing ScrollView to NestedScrollView
android.support.v4.widget.NestedScrollView

Try to add a LinearLayout inside your ScrollView(ScrollView --> LiearLayout-->RelativeLayout--> ...). Or just add android:fillViewport="true" to your Scrollview.

Bro, I just copied your code to m xml and there is no problem with the scrolling...if you still have a problem then just add a relative layout before scrollview ....like this
RelativeLAyout>ScrollView>RelativeLayout

Try this
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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="wrap_content"
android:fillViewport="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/relativelayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/imglayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/cvprofile"
android:layout_width="86dp"
android:layout_height="86dp"
android:layout_margin="12dp"
android:src="#drawable/img"
app:civ_border_color="#a4a4a4"
app:civ_border_width="0.5dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/digitlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="12dp"
android:layout_toRightOf="#id/imglayout">
<TextView
android:id="#+id/post"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="100"
android:textColor="#color/black"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/followers"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="100"
android:textColor="#color/black"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/following"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="43"
android:textColor="#color/black"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/textlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/digitlayout"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="#id/imglayout">
<TextView
android:id="#+id/posts"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="posts"
android:textSize="16sp" />
<TextView
android:id="#+id/followerss"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="follwers"
android:textSize="16sp" />
<TextView
android:id="#+id/followings"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="follwers"
android:textSize="16sp" />
</LinearLayout>
<TextView
android:id="#+id/tvedit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/textlayout"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#id/imglayout"
android:background="#drawable/bg_textview"
android:gravity="center_horizontal"
android:text="#string/edit_profile"
android:textColor="#color/black"
android:textSize="15sp"
android:textStyle="bold" />
<View
android:id="#+id/view1"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="#id/imglayout"
android:background="#b6b6b6" />
<android.support.design.widget.TabLayout
android:id="#+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/view1"
app:tabGravity="fill"
app:tabIndicatorHeight="0dp"
app:tabMode="fixed">
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="#drawable/frame1" />
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="#drawable/frame1" />
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="#drawable/frame1" />
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="#drawable/frame1" />
</android.support.design.widget.TabLayout>
<View
android:id="#+id/view2"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="#id/tabLayout"
android:background="#b6b6b6" />
<FrameLayout
android:id="#+id/framelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/view2"></FrameLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>

Related

How to affix a LinearLayout at the bottom of a screen in coordinator layout?

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>

How do I make my layout (which is inside a tab linearlayout, take up the whole screen?

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

layout_below not working with layout_centerVertical

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>

Xamarin Android CoordinatorLayout hide/show another layout than toolbar

I need a help with CoordinatorLayout... I need hide/show toolbar when scrolling and together with this hiding behavior I need make smaller text and hide another layout in my AppBarLayout...
My layout looks like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="#+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/main_light_gray">
<include
layout="#layout/toolbar_layout_filter_sales" />
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
local:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/main_light_gray">
<android.support.design.widget.TabLayout
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:id="#+id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/tablayout_background"
local:tabIndicatorColor="#color/main_red"
local:tabIndicatorHeight="0dp"
local:tabGravity="center"
local:tabBackground="#drawable/tab_background_selector"
local:tabMode="fixed"
local:tabPaddingStart="20dp"
local:tabPaddingEnd="20dp"
local:tabTextColor="#color/main_dark_text"
local:tabSelectedTextColor="#color/white" />
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="fill_parent"
local:layout_behavior="#string/appbar_scrolling_view_behavior" />
</LinearLayout>
</RelativeLayout>
<!--</LinearLayout>-->
</android.support.design.widget.CoordinatorLayout>
Layout toolbar_layout_filter_sales looks like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/layout_rounded_corners"
android:stateListAnimator="#null"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
local:layout_scrollFlags="scroll|enterAlways"
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
local:popupTheme="#style/ThemeOverlay.AppCompat.Light">
<LinearLayout
android:layout_marginTop="25dp"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<TextView
android:textStyle="bold"
android:textColor="#color/white"
android:id="#+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
style="#style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_gravity="center" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:id="#+id/toolbar_refresh_layout"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/toolbar_refresh"
android:layout_width="20dp"
android:layout_height="20dp"
android:scaleType="centerInside"
android:src="#drawable/ic_refresh" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
<LinearLayout
android:id="#+id/filterLayout"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dp">
<TextView
android:textSize="18dp"
android:textStyle="bold"
android:ellipsize="marquee"
android:maxLines="1"
android:text="Today"
local:MvxBind="Text SelectedFilterText"
android:textColor="#color/white"
android:id="#+id/filterTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="2dp"
android:layout_marginBottom="1dp" />
<Button
android:textAllCaps="false"
android:id="#+id/filterButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14dp"
android:text="15.5.2018"
local:MvxBind="Text CurrentPeriod"
android:ellipsize="marquee"
android:maxLines="1"
android:textColor="#color/white"
android:gravity="center_vertical"
android:textStyle="normal"
android:background="#android:color/transparent"
android:drawableEnd="#drawable/arrow_down_white"
android:drawablePadding="10dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="0dp" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/main_dark_line"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="0dp" />
<LinearLayout
android:id="#+id/filterLayout"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp">
<TextView
android:text="58 395,00"
local:MvxBind="TextFormatted TotalSales, Converter=SpannableStringPriceConverter"
android:textSize="26dp"
android:textStyle="bold"
android:ellipsize="marquee"
android:maxLines="1"
android:textColor="#color/white"
android:id="#+id/salesTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp" />
<TextView
local:MvxBind="Text LastUpdate, Converter=LastUpdateConverter"
android:textSize="12dp"
android:textStyle="italic"
android:ellipsize="marquee"
android:maxLines="1"
android:text="XX"
android:textColor="#color/white"
android:id="#+id/lastUpdateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
</LinearLayout>
</android.support.design.widget.AppBarLayout>
In default it looks like this:
After scrolling I have this:
But I need something like this:
I need text with value make smaller and text under value hide.

Android ViewPager inside a NestedScrollView

I need to show some text and at the bottom I need two tabs. The current code works only if the text is small, if the text fills the whole screen, then the tabs are not shown when scrolling.
My activity XML is:
<?xml version="1.0" encoding="utf-8"?>
<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:fillViewport="true"
tools:context="dk.zispa.vibetasks.TaskDetailedView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/task_view_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/taskTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:clickable="true"
android:focusable="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/black"
android:textSize="20sp" />
<TextView
android:id="#+id/taskBreadcrumbs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/taskTitle"
android:layout_marginStart="5dp"
android:layout_marginTop="3dp"
android:clickable="true"
android:focusable="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/secondaryText"
android:textSize="14sp" />
<View
android:id="#+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#id/taskBreadcrumbs"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="#color/divider" />
<TextView
android:id="#+id/taskDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/divider"
android:layout_marginStart="5dp"
android:clickable="false"
android:focusable="false"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/secondaryText" />
<LinearLayout
android:id="#+id/hoursInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/taskDescription"
android:layout_margin="5dp"
android:orientation="horizontal">
<TextView
android:id="#+id/taskEstimatedHours"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/orange"
android:gravity="center"
android:paddingBottom="3dp"
android:paddingTop="3dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<TextView
android:id="#+id/taskWorkedHours"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/colorPrimaryLight"
android:gravity="center"
android:paddingBottom="3dp"
android:paddingTop="3dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
</LinearLayout>
</RelativeLayout>
<android.support.v4.view.ViewPager
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/hoursInfo">
<android.support.design.widget.TabLayout
android:id="#+id/book_tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill">
<android.support.design.widget.TabItem
android:id="#+id/book_description_tab_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TAB1" />
<android.support.design.widget.TabItem
android:id="#+id/book_reviews_tab_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TAB2" />
</android.support.design.widget.TabLayout>
</android.support.v4.view.ViewPager>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
Do you have any ideas how can I make the tabs visible when you scroll down?
Thank you in advance
You can try to replace the LinearLayout with RelativeLayout. Put the task_view_layout with alignParentTop="true" and the view pager with alignParentBottom="true" and layoutBelow="#+id/task_view_layout"

Categories

Resources