Recycler Просмотр в другом представлении Recycler Обе вертикальные прокрутки внутри прокрутки представления в Recycler не работают
RecyclerView rvItem = findViewById (R.id.rv_item);NestedScrollView nestedScrollView = findViewById (R.id.nestedScroll);rvItem.setNestedScrollingEnabled (ложь);LinearLayoutManager layoutManager = new LinearLayoutManager (MainActivity.this);ItemAdapter itemAdapter = новый ItemAdapter (buildItemList (), nestedScrollView);rvItem.setAdapter (itemAdapter);rvItem.setLayoutManager (layoutManager);
в боковом адаптере элемента: -
LinearLayoutManager layoutManager = new LinearLayoutManager(itemViewHolder.rvSubItem.getContext(),LinearLayoutManager.VERTICAL,
false);
SubItemAdapter subItemAdapter = new SubItemAdapter(item.getSubItemList());
itemViewHolder.rvSubItem.setLayoutManager(layoutManager);
itemViewHolder.rvSubItem.setAdapter(subItemAdapte
r);
дочерний xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="#f3f3f3"
app:cardElevation="8dp"
android:layout_margin="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:orientation="vertical">
<TextView
android:id="@+id/tv_item_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12sp"
android:textSize="18sp"
android:text="Item Title"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_sub_item"
android:layout_width="match_parent"
android:layout_height="400dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>