How to use RecyclerView inside NestedScrollView?

前端 未结 24 2824
抹茶落季
抹茶落季 2020-11-22 03:39

How to use RecyclerView inside NestedScrollView? RecyclerView content is not visible after setting adapter.

UPDATE

24条回答
  •  闹比i
    闹比i (楼主)
    2020-11-22 04:21

    1) You need to use support library 23.2.0 (or) above

    2) and RecyclerView height will be wrap_content.

    3) recyclerView.setNestedScrollingEnabled(false)

    But by doing this the recycler pattern doesn't work. (i.e all the views will be loaded at once because wrap_content needs the height of complete RecyclerView so it will draw all child Views at once. No view will be recycled). Try not to use this pattern unless it is really required. Try to useviewTypeand add all other views that need to scroll toRecyclerViewrather than usingRecyclerViewinScrollview`. The performance impact will be very high.

    To make it simple "it just acts as LinearLayout with all the child views"

提交回复
热议问题