android-appbarlayout
After migrating to AndroidX, Error inflating class android.support.design.widget.AppBarLayout
You need to use com.google.android.material.appbar.AppBarLayout. Version 1.0.0 is already out So you can use implementation ‘androidx.appcompat:appcompat:1.0.0’ Add dependency implementation ‘com.google.android.material:material:1.0.0’ See Material Component integration for latest release version. And use <com.google.android.material.appbar.AppBarLayout android:layout_width=”match_parent” android:layout_height=”wrap_content”> </com.google.android.material.appbar.AppBarLayout> For other artifact and Class Mapping see the AndroidX migration Doc.
CoordinatorLayout inside another CoordinatorLayout
I know it’s an old question. But I searched a long time to include an CoordinatorLayout in a fragment, which is in another CoordinatorLayout. I modified the answer of dev.bmax a little bit to call both coordinator layouts and call the attached behaviors of both layouts. So here is my solution. @SuppressWarnings(“unused”) public class NestedCoordinatorLayout … Read more
ListView not expanding inside NestedScrollView
you can fix it when you add addtribute android:fillViewport=”true” in android.support.v4.widget.NestedScrollView 🙂 . This my code. <android.support.v4.widget.NestedScrollView android:layout_width=”match_parent” android:layout_height=”match_parent” android:scrollbars=”none” app:layout_behavior=”@string/appbar_scrolling_view_behavior” android:fillViewport=”true” > <ListView android:id=”@+id/list_myContent” android:layout_width=”match_parent” android:layout_height=”match_parent” android:scrollbars=”vertical” > </ListView> </android.support.v4.widget.NestedScrollView>
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
Remove elevation shadow without removing elevation itself
To complete M.Sandholtz answer, you can also define this in XML, with outlineProvider=”none”. <View android:id=”@+id/viewElevationNoShadow” android:outlineProvider=”none” android:elevation=”4dp” />
Need to disable expand on CollapsingToolbarLayout for certain fragments
Disable nested scrolling on the scrolling fragment content: recyclerView.setNestedScrollingEnabled(false); Use this if you’re using the support library: ViewCompat.setNestedScrollingEnabled(recyclerView, false);
CoordinatorLayout + AppBarLayout + NavigationDrawer
Your CoordinatorLayout is wrapping your DrawerLayout and NavigationView, which means the Coordinator is in control of how everything is laid out. You need to nest the Coordinator inside the drawer, like so: <android.support.v4.widget.DrawerLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/drawer_layout” android:layout_width=”match_parent” android:layout_height=”match_parent” android:clickable=”true” android:focusableInTouchMode=”true”> <android.support.design.widget.CoordinatorLayout xmlns:app=”http://schemas.android.com/apk/res-auto” android:id=”@+id/overview_coordinator_layout” android:layout_width=”match_parent” android:layout_height=”match_parent”> <android.support.design.widget.AppBarLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:theme=”@style/ThemeOverlay.AppCompat.Dark.ActionBar”> <android.support.v7.widget.Toolbar android:id=”@+id/toolbar” android:layout_width=”match_parent” android:layout_height=”?attr/actionBarSize” android:background=”?attr/colorPrimaryDark” app:layout_scrollFlags=”enterAlways|scroll” /> … Read more
Android Layout: Horizontal Recyclerview inside a Vertical Recyclerview inside a Viewpager with Scroll Behaviors
Tested solution: All you need is to call mInnerRecycler.setNestedScrollingEnabled(false); on your inner RecyclerViews Explanation: RecyclerView has support for nested scrolling introduced in API 21 through implementing the NestedScrollingChild interface. This is a valuable feature when you have a scrolling view inside another one that scrolls in the same direction and you want to scroll the … Read more
Toolbar in AppBarLayout is scrollable although RecyclerView has not enough content to scroll
Edit 2: Turns out the only way to ensure Toolbar is not scrollable when RecyclerView is not scrollable is to set setScrollFlags programmatically which requires to check if RecyclerView’s is scrollable. This check has to be done every time adapter is modified. Interface to communicate with the Activity: public interface LayoutController { void enableScroll(); void … Read more