Saturday, August 13, 2016

Making NestedScrollView Scroll Smoothly

I recently wrote my first app, OpenStax CNX Music, using CoordinatorLayout and Material Design. I used the Android Studio project template to help me get started which was also a first. It was both a good and a bad idea. It was good because it set me on the right path. The bad was that I had to think differently about how to structure layouts and code. Not really bad, but a learning experience. One of the problems I had was the janky scrolling when using a RecyclerView in a NestedScrollView. I finally found a solution.

In LandingListFragment.onCreate(), I disabled nested scrolling on the RecyclerView.

recyclerView.setNestedScrollingEnabled(false);

OpenStax CNX Music is in the Play Store and the code is open source in Github.