How to remove focus from RecyclerView inside ScrollView?

前端 未结 5 1388
傲寒
傲寒 2020-12-05 07:37

I have a Scrollview which contains an ImageView and RecyclerView. if navigation drawer opened then closed the RecyclerView auto scrolling to top, How to stop this?



        
5条回答
  •  情话喂你
    2020-12-05 08:20

    Adding android:descendantFocusability="blocksDescendants" can restrict scroll to recylerview but if you have edittext inside your layout, this property can block the focus of that particular edittext too. So if you are using this property please make sure you are removing this property in your kotlin/java class once the layout loaded.

    parentLayout?.descendantFocusability = FOCUS_BEFORE_DESCENDANTS (view as ViewGroup).descendantFocusability = FOCUS_BEFORE_DESCENDANTS

提交回复
热议问题