How to disable or stop coordinate layout scroll - android

I'm facing one issue.
I have a coordinate layout and inside I have the toolbar and all that.
I have also one frame layout inside it and in-frame layout I have three fragments.
One chat fragment is there, in that I have one recycler view.
When moving to that tab I scroll the layout with AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL or AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED.
But when I scroll recycler view, coordinate layout also scrolls.
I want the coordinate layout scroll only the first time and want to diable when recycler view scrolls.
Here is my XML file.
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.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:id="#+id/co_ordinate_layout"
android:layout_height="match_parent"
android:background="#color/offwhite">
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/offwhite"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
tools:ignore="ExtraText">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="#+id/collapseBar"
android:layout_width="match_parent"
android:layout_height="200dp"
app:expandedTitleMarginBottom="94dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#null"
android:backgroundTint="#color/white"
android:visibility="visible"
app:layout_collapseMode="pin"
app:navigationIcon="#drawable/ic_cancel" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
<TextView
android:id="#+id/tv_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/_7sdp"
android:gravity="center"
android:orientation="vertical"
android:padding="#dimen/_7sdp"
android:text="Mimi51"
android:textColor="#color/secondary_text"
android:textSize="#dimen/_20sdp"
app:layout_scrollFlags="scroll|enterAlways|snap" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/llProfile"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/tvProfile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:paddingStart="#dimen/_5sdp"
android:paddingEnd="#dimen/_5sdp"
android:text="#string/profile"
android:textAllCaps="true"
android:textColor="#color/secondary_text"
android:textSize="#dimen/normal_textsize"
android:textStyle="bold" />
<View
android:id="#+id/viewProfile"
android:layout_width="match_parent"
android:layout_height="#dimen/_2sdp"
android:background="#color/theme" />
</LinearLayout>
<LinearLayout
android:id="#+id/llPlayList"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/tvPlayList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:paddingStart="#dimen/_5sdp"
android:paddingEnd="#dimen/_5sdp"
android:text="#string/playlist"
android:textAllCaps="true"
android:textColor="#color/secondary_text"
android:textSize="#dimen/normal_textsize"
android:textStyle="bold" />
<View
android:id="#+id/viewPlayList"
android:layout_width="match_parent"
android:layout_height="#dimen/_2sdp"
android:background="#color/theme" />
</LinearLayout>
<LinearLayout
android:id="#+id/llChat"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal"
android:paddingStart="#dimen/_5sdp"
android:paddingEnd="#dimen/_5sdp">
<TextView
android:id="#+id/tvChat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:text="Chat"
android:textAllCaps="true"
android:textColor="#color/secondary_text"
android:textSize="#dimen/normal_textsize"
android:textStyle="bold" />
<TextView
android:id="#+id/tvChatConut"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_5sdp"
android:background="#drawable/stock_chat_count"
android:orientation="vertical"
android:paddingStart="#dimen/_10sdp"
android:paddingTop="#dimen/_2sdp"
android:paddingEnd="#dimen/_10sdp"
android:paddingBottom="#dimen/_2sdp"
android:text="1"
android:textAllCaps="true"
android:textColor="#color/theme"
android:textSize="#dimen/small_textsize" />
</LinearLayout>
<View
android:id="#+id/viewChat"
android:layout_width="match_parent"
android:layout_height="#dimen/_2sdp"
android:background="#color/theme" />
</LinearLayout>
</LinearLayout>
<View
android:id="#+id/view_header"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/gray_light"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/cl_header" />
</com.google.android.material.appbar.AppBarLayout>
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/imgProfile"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:elevation="8dp"
android:padding="3dp"
android:src="#color/theme"
app:layout_anchorGravity="top|center_horizontal"
app:layout_scrollFlags="scroll" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

Related

How to vertically scroll whole content with TabLayout, which starting in middle of screen?

I have TabLayout with 3 tabs and it works well. Tabs are scrolling inside if content not fitting to screen. Now I want to vertically scroll whole content except toolbar. Currently I'm scrolling inside tablayout, but I need to scroll header linearlayout and tablayout, which starts in middle of screen.
P.S. Tried ScrollView, but then scroll not worked at all (including scrolling tabs inside). Also content in tabs not showing up
Layout:
<?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"
tools:context=".GameInfoActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="#color/colorPrimaryDark"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#ffffff">
<ProgressBar
android:id="#+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingBottom="8dp"
android:paddingTop="8dp">
<TextView
android:id="#+id/team1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxWidth="240dp"
android:text="Team 1"
android:textColor="#color/colorBlackBG"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text=" - "
android:textColor="#color/colorBlackBG" />
<TextView
android:id="#+id/team2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxWidth="240dp"
android:text="Team 2"
android:textColor="#color/colorBlackBG"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/gameInfo_league_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:text="League Name" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="#+id/gameInfo_flag1"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginTop="8dp"
android:text="date"
android:textColor="#b71c1c"
android:textSize="14sp"
app:srcCompat="#drawable/game_info_flag_placeholder" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0:0"
android:textColor="#777777"
android:textSize="24sp" />
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="date"
android:textColor="#b71c1c"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="#+id/gameInfo_flag2"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginTop="8dp"
android:text="date"
android:textColor="#b71c1c"
android:textSize="14sp"
app:srcCompat="#drawable/game_info_flag_placeholder" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimaryDark"
app:tabIndicatorColor="#color/colorAccent"
app:tabIndicatorHeight="4dp"
app:tabSelectedTextColor="#android:color/white"
app:tabTextColor="#android:color/white">
<android.support.design.widget.TabItem
android:id="#+id/tabItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/match_details" />
<android.support.design.widget.TabItem
android:id="#+id/tabItem2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/head_to_head" />
<android.support.design.widget.TabItem
android:id="#+id/tabItem3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/prediction" />
</android.support.design.widget.TabLayout>
<android.support.v4.view.ViewPager
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</LinearLayout>
</LinearLayout>
Screenshot:
Please use Coordinate Layout and AppBarLayout. You can check this link for different scrolls.
https://github.com/codepath/android_guides/wiki/Handling-Scrolls-with-CoordinatorLayout
This link shows you exactly what you want to acheive
https://gist.github.com/iPaulPro/1468510f046cb10c51ea

Android - How to vertically scroll whole content with TabLayout, which starting in middle of screen?

I have TabLayout with 3 tabs and it works well. Tabs are scrolling inside if content not fitting to screen. Now I want to vertically scroll whole content except toolbar. Currently I'm scrolling inside tablayout, but I need to scroll header linearlayout and tablayout, which starts in middle of screen.
Layout:
<?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"
tools:context=".GameInfoActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="#color/colorPrimaryDark"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#ffffff">
<ProgressBar
android:id="#+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingBottom="8dp"
android:paddingTop="8dp">
<TextView
android:id="#+id/team1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxWidth="240dp"
android:text="Team 1"
android:textColor="#color/colorBlackBG"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text=" - "
android:textColor="#color/colorBlackBG" />
<TextView
android:id="#+id/team2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxWidth="240dp"
android:text="Team 2"
android:textColor="#color/colorBlackBG"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/gameInfo_league_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:text="League Name" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="#+id/gameInfo_flag1"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginTop="8dp"
android:text="date"
android:textColor="#b71c1c"
android:textSize="14sp"
app:srcCompat="#drawable/game_info_flag_placeholder" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0:0"
android:textColor="#777777"
android:textSize="24sp" />
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="date"
android:textColor="#b71c1c"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="#+id/gameInfo_flag2"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginTop="8dp"
android:text="date"
android:textColor="#b71c1c"
android:textSize="14sp"
app:srcCompat="#drawable/game_info_flag_placeholder" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimaryDark"
app:tabIndicatorColor="#color/colorAccent"
app:tabIndicatorHeight="4dp"
app:tabSelectedTextColor="#android:color/white"
app:tabTextColor="#android:color/white">
<android.support.design.widget.TabItem
android:id="#+id/tabItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/match_details" />
<android.support.design.widget.TabItem
android:id="#+id/tabItem2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/head_to_head" />
<android.support.design.widget.TabItem
android:id="#+id/tabItem3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/prediction" />
</android.support.design.widget.TabLayout>
<android.support.v4.view.ViewPager
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</LinearLayout>
</LinearLayout>
Screenshot:
Usually, you use a ScrollView.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- Content starts here -->
</LinearLayout>
</ScrollView>
so all elements, that should "scroll together" like one big element should be inside a LinearLayout that is inside the ScrollView

Space between the View pager and tabLayout which is inside collpasing toolbar

Some empty space is shown after tab Layout. I have the view pager outside the app bar layout and tab layout inside the Relative Layout which is inside of collapsing toolbar. Not able to determine from where this extra space is added. Any help would be appreciated. The hierarchy of the views is Coordinator, App Bar, Collapsing Toolbar, Frame Layout, Relative Layout, Tab Layout.
Below is the code
<?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:fresco="http://schemas.android.com/apk/res-auto"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/grey_bg"
android:fitsSystemWindows="true"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="#+id/appBar"
android:layout_width="match_parent"
android:layout_height="500dp"
android:background="?attr/colorPrimary">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleTextAppearance="#style/TextAppearance.AppCompat.Title"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:titleEnabled="false">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_collapseMode="parallax">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/header_picture"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:background="#drawable/splash"
android:orientation="horizontal"
android:visibility="visible" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:id="#+id/tv_profile_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:layout_marginTop="60dp"
android:text="Kunal Bagla"
android:textColor="#android:color/black"
android:textSize="19dp" />
<TextView
android:id="#+id/tv_profile_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/tv_profile_name"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:text="Udaipur"
android:textColor="#android:color/black"
android:textSize="15dp" />
<TextView
android:id="#+id/tv_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:background="#drawable/black_border_rounded"
android:gravity="right"
android:paddingBottom="10dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingTop="10dp"
android:text="Settings"
android:textColor="#android:color/black"
android:textSize="15dp"
android:visibility="visible" />
<android.support.design.widget.TabLayout
android:id="#+id/tablayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_profile_location"
android:layout_marginTop="10dp"
app:tabIndicatorColor="#color/orange"
/>
</RelativeLayout>
</LinearLayout>
<com.facebook.drawee.view.SimpleDraweeView
android:id="#+id/drawee_avatar"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center|left"
android:layout_marginLeft="20dp"
fresco:placeholderImage="#drawable/home_bg"
fresco:placeholderImageScaleType="centerCrop"
fresco:roundAsCircle="true" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|left"
android:layout_marginLeft="110dp">
<TextView
android:id="#+id/drawee_camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="8dp"
android:text="camera"
android:textAlignment="center"
android:textColor="#color/whiteColor"
android:textSize="12sp" />
</FrameLayout>
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/orange"
app:layout_collapseMode="pin"
android:minHeight="?attr/actionBarSize"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<LinearLayout
android:id="#+id/ll_sub_main_dice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/menu_icon_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:padding="5dp" />
<Button
android:id="#+id/button_app_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/tv_login_logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="right"
android:padding="5dp" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
Some empty space is shown after tab Layout.
Specyfy what u meen ( is there inside of tab layout or outside the best print printscreen)
Is there only in 1 place this extra space or in all AppBarLayout
And u modify in activities those items?
I woud check first behavior those layout at solo and add 1 by 1 next items and then u probly see what's wrong and abou
Here is the solution if required by some one else. If you want your toolbar to be fixed and content to be scrolled under use collapse mode as pin for toolbar and scrollFlags as scroll|exitAlwaysCollapsed for collapsing toolbar
<?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:fresco="http://schemas.android.com/apk/res-auto"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/grey_bg"
android:fitsSystemWindows="true"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="#+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleTextAppearance="#style/TextAppearance.AppCompat.Title"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:titleEnabled="false">
<android.support.constraint.ConstraintLayout
android:id="#+id/parentLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/image_view_product"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/splash" />
<com.facebook.drawee.view.SimpleDraweeView
android:id="#+id/drawee_avatar"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center|left"
android:layout_marginLeft="20dp"
android:layout_marginTop="100dp"
app:layout_constraintBottom_toBottomOf="#+id/image_view_product"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#+id/image_view_product"
fresco:placeholderImage="#drawable/home_bg"
fresco:placeholderImageScaleType="centerCrop"
fresco:roundAsCircle="true" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|left"
android:layout_marginLeft="110dp"
android:visibility="visible">
<TextView
android:id="#+id/drawee_camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="8dp"
android:text="camera"
android:textAlignment="center"
android:textColor="#color/whiteColor"
android:textSize="12sp" />
</FrameLayout>
<TextView
android:id="#+id/tv_profile_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginStart="15dp"
android:layout_marginTop="70dp"
android:text="XYZ"
android:textColor="#android:color/black"
android:textSize="19dp"
app:layout_constraintTop_toBottomOf="#id/image_view_product" />
<TextView
android:id="#+id/tv_profile_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/tv_profile_name"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:text="Location"
android:textColor="#android:color/black"
android:textSize="15dp"
app:layout_constraintTop_toBottomOf="#+id/tv_profile_name" />
<TextView
android:id="#+id/tv_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:background="#drawable/black_border_rounded"
android:gravity="right"
android:paddingBottom="10dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingTop="10dp"
android:text="Settings"
android:textColor="#android:color/black"
android:textSize="15dp"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#id/image_view_product" />
<android.support.design.widget.TabLayout
android:id="#+id/tablayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="#+id/tv_profile_location"
android:layout_below="#+id/tv_profile_location"
android:layout_marginTop="10dp"
app:tabIndicatorColor="#color/orange" />
</android.support.constraint.ConstraintLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/orange"
android:minHeight="?attr/actionBarSize"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_collapseMode="parallax">
<LinearLayout
android:id="#+id/ll_sub_main_dice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/menu_icon_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:padding="5dp" />
<Button
android:id="#+id/button_app_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/tv_login_logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="right"
android:padding="5dp" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" /></android.support.design.widget.CoordinatorLayout>

Recycler View inside Nested Scroll View not displayed completely

Recycler view contents are not completely shown which is inside nested scroll view. I have gone through all possible solutions suggested but none turned out to be helpful.
XML Layout is below:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF">
<android.support.design.widget.AppBarLayout
android:id="#+id/collapsingappbar"
android:layout_width="match_parent"
android:layout_height="385dp"
android:background="#color/colorPrimary">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsingtool"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="#color/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:fitsSystemWindows="true"
android:titleTextColor="#color/colorPrimary"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="#+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:layout_marginLeft="8dp"
android:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/toolbar"
android:orientation="vertical">
<TextView
android:id="#+id/movietitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="#string/name"
android:textColor="#color/detailstextcolor"
android:textSize="18sp" />
<TextView
android:id="#+id/moviename"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textColor="#color/detailstextcolor"
android:textSize="14sp" />
<TextView
android:id="#+id/movieoverviews"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="#string/overview"
android:textColor="#color/detailstextcolor"
android:textSize="18sp" />
<TextView
android:id="#+id/movieoverview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textColor="#color/detailstextcolor"
android:textSize="14sp" />
<TextView
android:id="#+id/moviedate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="#string/date"
android:textColor="#color/detailstextcolor"
android:textSize="18sp" />
<TextView
android:id="#+id/movierelease"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textColor="#color/detailstextcolor"
android:textSize="14sp" />
<TextView
android:id="#+id/movievotes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="#string/votes"
android:textColor="#color/detailstextcolor"
android:textSize="18sp" />
<TextView
android:id="#+id/movievote"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textColor="#color/detailstextcolor"
android:textSize="14sp" />
<TextView
android:id="#+id/movieratings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="#string/rating"
android:textColor="#color/detailstextcolor"
android:textSize="18sp" />
<TextView
android:id="#+id/movierating"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textColor="#color/detailstextcolor"
android:textSize="14sp" />
<View
android:id="#+id/seperator"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#color/detailstextcolor" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="#string/titlevideos"
android:textColor="#color/detailstextcolor"
android:textSize="14sp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/videos"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout></RelativeLayout>
Populating with grid layout manager. I tired to set nested scrolling false. But it didn't work either.
RecyclerView.LayoutManager layoutManager = new GridLayoutManager(this,2);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setNestedScrollingEnabled(false);
Layout which uses recycler view.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="4dp"
android:elevation="4dp"
card_view:cardCornerRadius="4dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<ImageView
android:id="#+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="160dp"
android:clickable="true"
android:foregroundGravity="center" />
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/thumbnail"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:textColor="#color/detailstextcolor" />
</RelativeLayout>
</android.support.v7.widget.CardView> </LinearLayout>`
Recycler view size changes dynamically which is fetched from an API. If size is say for eg.4, then last 2 card views bottom half are cut off from screen and if size is 5, then last one view is cut off.
Support library used is v24. Anything I am missing here?

how to put a transparent layout above floating action button

I am working on an app and i want to put a transparent view over whole screen and i have gained success on this by some percent but my screen contains floating action buttons also
I am unable to put the transparent layout above floating action button
this is my xml
<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/root_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.groomefy.consumer.Trending.DetailedActivity">
<android.support.design.widget.AppBarLayout
android:id="#+id/app_bar"
android:layout_width="370dp"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="-10dp"
app:layout_collapseMode="parallax">
<ImageView
android:id="#+id/main_image"
android:layout_width="match_parent"
android:layout_height="430dp"
android:scaleType="fitEnd"
android:src="#drawable/image_placeholder_square" />
<!--
<ImageView
android:id="#+id/curve_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_marginBottom="-20dp"
android:scaleType="fitEnd"
android:src="#drawable/postdetail_curve"
app:layout_anchor="#id/main_image"
app:layout_collapseMode="none" />
-->
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/white"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin"
app:popupTheme="#style/AppTheme.PopupOverlay">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<ImageButton
android:id="#+id/btn_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="#android:color/transparent"
android:padding="10dp"
android:src="#drawable/backicon" />
<com.groomefy.consumer.fontutils.OpenSansBold
android:id="#+id/title_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="#string/fragment_blogs"
android:textColor="#color/title_text_color"
android:textSize="#dimen/title_text_size"
android:textStyle="bold" />
<ImageView
android:id="#+id/iv_more"
android:layout_width="#dimen/more_btn_height"
android:layout_height="#dimen/more_btn_height"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:scaleType="center"
android:src="#drawable/more" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#a6a6a6" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="#+id/nested_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/main_root_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardBackgroundColor="#color/white">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="35dp"
android:gravity="left"
android:orientation="vertical"
android:padding="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:id="#+id/likes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="likes"
android:textSize="16sp" />
<TextView
android:id="#+id/comments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_toRightOf="#+id/likes"
android:text="comments"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.groomefy.consumer.fontutils.OpenSansRegular
android:id="#+id/blog_main_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="di am first #firsttag i am second #secondtag and i am third #thirtag di am first #firsttag i am second #secondtag and i am third #thirtag di am first #firsttag i am second #secondtag and i am third #thirtag di am first #firsttag i am second #secondtag and i am third #thirtag"
android:textSize="15sp" />
<com.groomefy.consumer.fontutils.OpenSansRegular
android:id="#+id/time_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/blog_main_text"
android:gravity="center_vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp"
android:text="this is time text "
android:textSize="15sp" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:id="#+id/header_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<FrameLayout
android:id="#+id/fl_profile_pic"
android:layout_width="45dp"
android:layout_height="45dp">
<ImageView
android:id="#+id/image_view_profile"
android:layout_width="#dimen/list_user_pro_img_radius"
android:layout_height="#dimen/list_user_pro_img_radius"
android:layout_marginLeft="3dp"
android:background="#color/grey_3"
android:scaleType="center"
android:src="#drawable/profile_placeholder_g" />
<ImageView
android:layout_width="48dp"
android:layout_height="#dimen/list_user_pro_img_radius"
android:background="#drawable/profile_placeholder_top_layer"
android:scaleType="fitXY" />
</FrameLayout>
<com.groomefy.consumer.fontutils.OpenSansBold
android:id="#+id/text_view_blogger_name"
style="#style/black.regular"
android:layout_centerVertical="true"
android:layout_marginLeft="#dimen/mar_hor_regular"
android:layout_toRightOf="#+id/fl_profile_pic"
android:gravity="top"
android:text="Jaine Helor" />
</RelativeLayout>
<com.groomefy.consumer.fontutils.OpenSansBold
android:id="#+id/get_similar_suggestions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:background="#drawable/text_rectangle"
android:gravity="center"
android:padding="2dp"
android:text="Get Similar Suggestions"
android:textAllCaps="true"
android:textColor="#color/title_text_color"
android:textStyle="bold" />
</LinearLayout>
</android.support.v7.widget.CardView>
</android.support.v4.widget.NestedScrollView>
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<View
android:id="#+id/tranparent_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/grey_very_light_semi_transparent"
android:elevation="15dp"
android:fitsSystemWindows="true"
android:visibility="gone" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/like_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="80dp"
android:background="#color/white"
android:elevation="10dp"
android:src="#drawable/like"
app:fabSize="normal"
app:layout_anchor="#id/app_bar"
app:layout_anchorGravity="bottom|center_vertical" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/fav_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="10dp"
android:src="#drawable/add_to_stylebook"
app:fabSize="normal"
app:layout_anchor="#id/app_bar"
app:layout_anchorGravity="bottom|center" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/share_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="70dp"
android:elevation="10dp"
android:src="#drawable/share"
app:fabSize="normal"
app:layout_anchor="#id/app_bar"
app:layout_anchorGravity="bottom|right" />
<LinearLayout
android:id="#+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="true"
android:fitsSystemWindows="true"
android:orientation="vertical"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<android.support.v7.widget.CardView
android:id="#+id/card_view_sharing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:cardBackgroundColor="#color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.groomefy.consumer.fontutils.OpenSansBold
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/grey_very_light"
android:gravity="center"
android:padding="5dp"
android:text="#string/share_this_look"
android:textAllCaps="true"
android:textColor="#color/black_text"
android:textSize="#dimen/sharing_text_size" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="10dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/share_on_facebook"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/facebook" />
<com.groomefy.consumer.fontutils.OpenSansRegular
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Facebook"
android:textSize="#dimen/sharing_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/share_on_whatsapp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/whatsapp" />
<com.groomefy.consumer.fontutils.OpenSansRegular
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="whatsapp"
android:textSize="#dimen/sharing_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/share_on_instagram"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/instagram" />
<com.groomefy.consumer.fontutils.OpenSansRegular
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Instagram"
android:textSize="#dimen/sharing_text_size" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
I have tried to fix this by elevation but failed to achieve this
can anyone please suggest me what should be the approach to put the layout above floating action button
add this line in your transparent view:
android:translationZ="8dp"
Android Layouts are Z - ordered ie., a layout defined after another will be on top of it visually. Add your transparent view after the container that holds the FAB, that way your transparent view will be on top of the FAB and effectively gets drawn over it.
Define your transparent layout after FAB. Like this -
<android.support.design.widget.FloatingActionButton
android:id="#+id/like_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="80dp"
android:background="#color/white"
android:elevation="10dp"
android:src="#drawable/like"
app:fabSize="normal"
app:layout_anchor="#id/app_bar"
app:layout_anchorGravity="bottom|center_vertical" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/fav_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="10dp"
android:src="#drawable/add_to_stylebook"
app:fabSize="normal"
app:layout_anchor="#id/app_bar"
app:layout_anchorGravity="bottom|center" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/share_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="70dp"
android:elevation="10dp"
android:src="#drawable/share"
app:fabSize="normal"
app:layout_anchor="#id/app_bar"
app:layout_anchorGravity="bottom|right" />
<View
android:id="#+id/tranparent_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/grey_very_light_semi_transparent"
android:elevation="15dp"
android:fitsSystemWindows="true"
android:visibility="gone" />

Categories

Resources