С созданием NestedScrollView вы можете поместить прокрутку в другое прокручиваемое представление, если они реализуют NestedScrollingChild и NestedScrollingParent правильно.
(Это неплохой шаблон дизайна "Янь-Лейк" (от Google) на самом деле рекомендует помещать RecyclerView
внутри вложенного просмотра: plus.google.com/u/0/+AndroidDevelopers/posts/9kZ3SsXdT2T ")
Я хочу поставить RecyclerView внутри NestedScrollView и, к счастью, RecyclerView реализует NestedScrollingChild, поэтому вы можете поместить его внутри NestedScrollView.
public class RecyclerView extends ViewGroup implements ScrollingView, NestedScrollingChild
Я прочитал эти сообщения:
Как использовать RecyclerView внутри NestedScrollView?
NestedScrolling с помощью NestedScrollView, RecyclerView (по горизонтали) внутри координатораLayout
Но проблема с большинством проголосовавших решений состоит в том, что она вызывает все элементы RecyclerView
, например, если это бесконечное RecyclerView, и когда пользователь достигает конца списка, который вы хотите сделать сетевым, тогда с это решение RecyclerView
вызывает сервер повторно, потому что оно автоматически достигает последнего элемента RecyclerView
.
В любом случае, как установить параметр, чтобы я мог поместить RecyclerView
внутрь NestedScrollView
. (на самом деле я хочу поставить группу просмотра как framelayout или relativelayout в качестве одного дочернего элемента nestedscrollview, а затем я хочу поместить recyclerview внутри framelayout или relativelayout )
Когда я помещаю RecyclerView
внутри NestedScrollView
, ничего не видно.
Чтобы создать образец проекта, вы можете использовать cheesesquare и изменить CheeseDetailActivity
на наличие RecyclerView.
Хотя ответ BNK неверен, но BNK много пробовал. Поэтому я награждаю его щедростью. Все еще ищет хорошее решение....