

So my recommandation is to refactor your code and replace ListViews with RecyclerViews if you intend to benefit from the power of CoordinatorLayout. This way, all the UI issues were solved much more easily. At first I had a ListView and tried to make the app work with it, but I ended up in refactoring the code and used RecyclerView instead. If you are using ListView instead of RecyclerView together with CoordinatorLayout, you will encounter different scrolling and UI issues that will be difficult to handle. But if you declare your RecyclerView directly inside CoordinatorLayout, you should add this property to it, and everything should be fine. This property MUST be added to your scrolling view in order to make all list’s items visible: my case, as I was using a FrameLayout which contained a RecyclerView, I had to add this property to the FrameLayout, and not directly to the RecyclerView as it was in another xml file and wouldn’t work.


But when I ran the app, the first item in the list was overlapped by the tabs, so it was not fully visible.įrameLayout is replaced in the code with a fragment containing the RecyclerView. I had to implement a Toolbar with tabs, together with CoordinatorLayout, and the content of each tab had to be a list of items, for which I used RecyclerView. setLayoutManager ( new LinearLayoutManager ( this )) CoordinatorLayout coordinatorLayout = ( CoordinatorLayout ) findViewById ( R. setAdapter ( itemAdapter ) // Set the layout manager recyclerView. cheese_2, "Cheese 2" )) // Instantiate adapter ItemAdapter itemAdapter = new ItemAdapter ( items, null ) recyclerView. design_bottom_sheet ) // Create your items ArrayList items = new ArrayList () items. RecyclerView recyclerView = ( RecyclerView ) findViewById ( R. Note: do not try to expand the bottom sheet inside an OnCreate() method because of this known issue. We need to use a click event to trigger the show and hide. The bottom sheet should be hidden by default. SetupĪdd the CoordinatorLayout to your dependency list in app/adle: dependencies This project is one of the easiest ways to understand CoordinatorLayout. The full source code can be found on github. Controlling which views should expand or collapse and at what rate, including parallax scrolling effects animations.Ĭhris Banes from Google has put together a beautiful demo of the CoordinatorLayout and other design support library features.

