Android 回收器视图内部回收器视图垂直滚动不工作
回收器视图位于另一个回收器视图内,两个视图均垂直滚动 内部回收器视图滚动不工作 RecyclerView rvItem=findViewById(R.id.rv_项目); NestedScrollView NestedScrollView=findViewById(R.id.nestedScroll); rvItem.setNestedScrollingEnabled(false); LinearLayoutManager layoutManager=新的LinearLayoutManager(MainActivity.this); ItemAdapter ItemAdapter=新的ItemAdapter(buildItemList(),nestedScrollView); rvItem.setAdapter(itemAdapter); rvItem.setLayoutManager(layoutManager) 在侧项适配器中:-Android 回收器视图内部回收器视图垂直滚动不工作,android,scrollview,android-recyclerview,Android,Scrollview,Android Recyclerview,回收器视图位于另一个回收器视图内,两个视图均垂直滚动 内部回收器视图滚动不工作 RecyclerView rvItem=findViewById(R.id.rv_项目); NestedScrollView NestedScrollView=findViewById(R.id.nestedScroll); rvItem.setNestedScrollingEnabled(false); LinearLayoutManager layoutManager=新的LinearLayoutManager
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>
将您的recyclerviews放入nestedscrollview并禁用嵌套滚动您可以发布您的code@kam1234请检查上面的代码后,您的主要xml