Smooth animated Collapsing Toolbar with Android Design Support Library

You can use the new layout_scrollFlag snap for smooth scroll within the AppBarLayout states. But what I have experienced is that, when the RecyclerView reaches top, scrolling stops. i.e CollapsingToolbarLayout won’t get expanded without another scroll. For the RecyclerView to scroll smoothly up and expand the CollapsingToolbarLayout I have used a ScrollListener on recyclerview. recyclerView.addOnScrollListener(new … Read more

Collapsing Toolbar layout with logo, title, subtitle in toolbar

I have preperead two amaizing avatar collapsing demo samples with approach that doesn’t use a custom CoordinatorLayoutBehavior! To view my samples native code: “Collapsing Avatar Toolbar Sample” To read my “Animation Collapsing Toolbar Android” post on Medium. demo 1 demo 2 Instead of use use a custom CoordinatorLayoutBehavior i use an OnOffsetChangedListener which comes from … Read more

How can I determine that CollapsingToolbar is collapsed?

As Marko said, this can be achieved using your own implementation of a OnOffsetChangedListener. AppBarLayout appBarLayout = (AppBarLayout) view.findViewById(R.id.app_bar_layout); appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { @Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { if (Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange()) { // Collapsed } else if (verticalOffset == 0) { // Expanded } else { // Somewhere in between } } … Read more

Android CollapsingToolbarLayout Title background

Use a text protection scrim(scroll down a bit). My example assumes the title text is white, so some tweaks may be necessary to optimize for your case. Inside your CollapsingToolbarLayout, add the following after ivBigImage: <View android:layout_width=”match_parent” android:layout_height=”@dimen/sheet_text_scrim_height_top” android:background=”@drawable/scrim_top” app:layout_collapseMode=”pin”/> <View android:layout_width=”match_parent” android:layout_height=”@dimen/sheet_text_scrim_height_bottom” android:layout_gravity=”bottom” android:layout_alignBottom=”@+id/image” android:background=”@drawable/scrim_bottom”/> In your Drawable folder, add: scrim_top.xml <shape xmlns:android=”http://schemas.android.com/apk/res/android”> <gradient … Read more

Add app bar scrolling view behavior to multiple views in CoordinatorLayout

You don’t need a workaround or something strange. This behaviour is supported by the library. Just replace your LinearLayout by this and put it below the RecyclerView: <android.support.v4.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” android:gravity=”center”> <Button android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:padding=”15dp” android:text=”Button text”/> </LinearLayout> </android.support.v4.widget.NestedScrollView> Also you will need to put this in your RecyclerView to … Read more

How to disable scrolling of NestedScrollView&CollapsingToolbarLayout, for example when there is no more content below?

What can I do in order to make the scrolling stop when there is no more content to show at the bottom? Firstly, as I have commented below, the scrolling you said in your question is not of the NestedScrollView. It belongs to the CollapsingToolbarLayout. The NestedScrollView‘s scroll event only happens when CollapsingToolbarLayout fully collapsed, … Read more

Android: CollapsingToolbarLayout and SwipeRefreshLayout get stuck

Update: This issue has been resolved in the latest version of the support library (23.1.1+). If you are using an older version of the support library either upgrade or continue reading. If you’re using an older version of the support library, add an offset change listener to your AppBarLayout to enable or disable your swipe … Read more

How to implement Custom Collapsable Toolbar in android?

The AppBarComponentprovides a method called .setExpanded(boolean expanded), which allows you to expand your AppBarComponent. But keep in mind, that this method relies on this layout being a direct child of a CoordinatorLayout. You can read this for more information. If you want to animate to a custom offset, try using the setTopAndBottomOffset(int) method. CoordinatorLayout.LayoutParams params … Read more