Closed Jhuku closed 7 years ago
Hi @Jhuku
It works with RecyclerView and NestedScrollView. It also works with other PullDownToRefresh as well.
What scroll view do you want to use with AppBarLayout beside RecyclerView and NestedScrollView?
I tried with nested scroll view. It doesn't work. I used app:sabl_target_id="@/nestedScroll" attribute inside SmoothAppBarLayout.
Can you post your layout here?
<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/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e6e6e6"
>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:id="@+id/nest"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="24dp"
>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/card_margin"
>
<LinearLayout
style="@style/Widget.CardContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Club Description"
android:textSize="15sp"
android:textStyle="bold"
android:textColor="@color/clubsChaptersPrimary"
/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:text="@string/club_description"
/>
<TextView
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Events conducted so far"
android:textSize="15sp"
android:textStyle="bold"
android:textColor="@color/clubsChaptersPrimary"
/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:text="Event1"
/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:text="Event2"
/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:text="Event3"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2"
>
<TextView
android:layout_marginTop="20dp"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="See Gallery"
android:textSize="15sp"
android:textColor="@color/clubsChaptersPrimary"
android:textStyle="bold"
/>
<CheckBox
android:layout_marginTop="20dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Show Notifications"
/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<me.henrytao.smoothappbarlayout.SmoothAppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="@dimen/detail_backdrop_height"
android:elevation="4dp"
app:sabl_target_id="@id/nest"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
app:title="Club Name"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:layout_height="match_parent"
android:navigationIcon="@drawable/back_button"
app:contentScrim="?attr/colorPrimaryDark"
>
<ImageView
android:layout_gravity="center"
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"
android:src="@drawable/scenary"
android:background="@color/white"
android:transitionName="@string/activity_image_trans"
/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:title="This is Toolbar"
/>
</android.support.design.widget.CollapsingToolbarLayout>
</me.henrytao.smoothappbarlayout.SmoothAppBarLayout>
</android.support.design.widget.CoordinatorLayout>
Hi @Jhuku
Please do following steps:
app:layout_behavior="@string/appbar_scrolling_view_behavior"
in your NestedScrollView
. => Do not use layout_behavior with SmoothAppBarLayout. app:sabl_target_id="@id/nest"
=> This is unnecessary in this layout.I hope it helps.
I see that SmoothAppBarLayout works only with recycler views. Why cant it be made more generic so that it works with any view.