I am facing one issue since past few days. Below is the issue details. I need to hide the top layout while scrolling the recyclerview, for that I am using "app:layout_behavior" in Coordinator layout with Collapisng toolbar.But after adding "app:layout_behavior="@string/appbar_scrolling_view_behavior" in Coordinator layout a blank space is coming at the top of the "com.customviewtext.customviews.recyclerviews.TrayRecyclerView". That recyclerview should start from the top of the layout.
<?xml version="1.0" encoding="utf-8"?>
<layout 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">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraint_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<com.customviewtext.customviews.recyclerviews.TrayRecyclerView
android:id="@+id/main_home_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:visibility="visible"
android:orientation="vertical"
android:paddingBottom="@dimen/page_margin_bottom"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
/>
<ImageView
android:id="@+id/l3_menu_back"
android:layout_width="@dimen/dimens_30dp"
android:layout_height="@dimen/dimens_30dp"
android:layout_marginStart="@dimen/l3_back_icon_margin"
android:layout_marginTop="@dimen/l2_menu_margin_top"
android:contentDescription="@string/no_go_back"
android:paddingTop="@dimen/dimens_5dp"
android:paddingBottom="@dimen/dimens_5dp"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/back_arrow" />
<com.customviewtext.fab.custom.CustomFabButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|start"
android:layout_marginEnd="@dimen/dimens_10dp"
android:layout_marginBottom="@dimen/dimens_86dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<pl.droidsonroids.gif.GifImageView
android:id="@+id/gifFLoat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_100"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageView
android:id="@+id/static_image"
android:layout_width="wrap_content"
android:background="@color/white"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_100"
android:contentDescription="@string/background_image_for_card_view"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ViewStub
android:id="@+id/cast_minicontroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="@dimen/dimens_8dp"
android:layout_marginEnd="@dimen/dimens_8dp"
android:layout_marginBottom="@dimen/minicontroller_bottom"
android:layout="@layout/cast_mini_controller_fragment"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/rl_home_cast"
android:layout_width="@dimen/home_cast_button_size"
android:layout_height="@dimen/home_cast_button_size"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="@dimen/dimens_15dp"
android:layout_marginBottom="@dimen/home_cast_button_bottom_margin"
android:background="@drawable/ic_home_cast_bg_new"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent "
app:layout_constraintEnd_toEndOf="parent">
<androidx.mediarouter.app.MediaRouteButton
android:id="@+id/pt_home_cast_icon"
android:layout_width="@dimen/home_cast_button_size"
android:layout_height="@dimen/home_cast_button_size"
android:layout_centerInParent="true"
android:backgroundTint="@color/white_color"
android:icon="@drawable/common_full_open_on_phone"
android:mediaRouteTypes="user"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:id="@+id/home_fragment_level_two_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/close_fab"
android:layout_width="@dimen/dimens_floating_close_icon"
android:layout_height="@dimen/dimens_25dp"
android:layout_gravity="bottom|end"
android:layout_marginEnd="@dimen/dimens_10dp"
android:layout_marginBottom="@dimen/dp_120"
android:src="@drawable/close_floating_button"
android:visibility="gone" />
</FrameLayout>
<ViewStub
android:id="@+id/page_loader"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout="@layout/layout_skeleton"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ViewStub
android:id="@+id/api_error_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout="@layout/api_error"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ViewStub
android:id="@+id/connection_error"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout="@layout/connection_error"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/my_appbar_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/home_top_menu"
android:animateLayoutChanges="true"
android:fitsSystemWindows="true"
>
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/top_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/recyclerview_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="5dp"
android:orientation="horizontal"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/click"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/app_name"
android:foregroundGravity="center"
android:scaleType="fitXY"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/sony_liv_logo" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/subscribe_renew_upgrade_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toEndOf="@+id/click"
app:layout_constraintTop_toTopOf="parent">
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/subscribe_button_frame_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dimens_5dp"
android:paddingTop="@dimen/dimens_2dp"
android:paddingEnd="@dimen/dimens_2dp"
tools:ignore="RtlSymmetry">
<ImageView
android:id="@+id/subscribe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/subscribe"
android:foregroundGravity="center"
android:scaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/subscribe_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dimens_5dp"
android:textColor="@color/white"
android:textSize="@dimen/l2_menu_text"
app:layout_constraintLeft_toLeftOf="@+id/right_icon"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="RtlSymmetry"
tools:text="hello" />
<ImageView
android:id="@+id/right_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/right_arrow_icon"
android:foregroundGravity="center"
android:paddingStart="@dimen/dimens_2dp"
android:paddingEnd="@dimen/dimens_5dp"
android:scaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/subscribe_title"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
<View
android:id="@+id/divider_line"
android:layout_width="@dimen/dimen_1dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/dimens_2dp"
android:background="@color/dark_grey"
android:scaleType="fitXY"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="@+id/frameLayout"
app:layout_constraintStart_toEndOf="@+id/frameLayout"
app:layout_constraintTop_toTopOf="@+id/frameLayout">
</View>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/search_more_icon"
android:layout_width="@dimen/dimens_25dp"
android:layout_height="@dimen/dimens_25dp"
android:layout_marginEnd="@dimen/dimens_10dp"
android:foregroundGravity="center"
android:padding="@dimen/dp_2"
android:scaleType="fitXY"
android:visibility="invisible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.9"
app:layout_constraintStart_toEndOf="@id/subscribe_renew_upgrade_layout"
app:layout_constraintTop_toTopOf="@id/click"
app:srcCompat="@drawable/ic_search_white" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_l2_menu"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:foregroundGravity="center"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/click"
app:layout_constraintTop_toBottomOf="@+id/click" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_l2_menu_navigation_fix"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/dimens_18dp"
android:layout_marginTop="5dp"
android:layout_gravity="bottom"/>
<!-- app:tabGravity="fill"
app:tabMode="scrollable"-->
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<data>
<import type="android.view.View" />
<variable
name="sampleData"
type="com.customviewtext.viewmodel.home.SampleViewModel" />
</data>
</layout>
Any help would be appreciated.