Search code examples
androidandroid-recyclerviewandroid-coordinatorlayout

Recyclerview automatically scroll up (a little) when update


I have a RecyclerView in CoordinatorLayout in a fragment, there is a problem with RecyclerView in some situations, when I reload this fragment or calling notifyDataSetChanged(), RecyclerView automatically scroll up a little (about 1 cm)!!!! And because of this, scrolling on AppBarLayout doe's not work! It's on android 4.2.2. I googled it and cant find anything about this!


Solution

  • Deepak Rathore answer worked for me.

    Adding android:descendantFocusability="blocksDescendants" to coordiante layout fixed my problem.