回收站视图内的回收站视图垂直滚动不起作用

时间:2019-10-31 07:34:55

标签: android android-recyclerview scrollview recycler-adapter

在另一个Recycler View中的Recycler View两者垂直滚动 回收站视图滚动内部不起作用

enter image description here     RecyclerView rvItem = findViewById(R.id.rv_item);             NestedScrollView nestedScrollView = findViewById(R.id.nestedScroll);             rvItem.setNestedScrollingEnabled(false);             LinearLayoutManager layoutManager = new LinearLayoutManager(MainActivity.this);             ItemAdapter itemAdapter =新的ItemAdapter(buildItemList(),nestedScrollView);             rvItem.setAdapter(itemAdapter);             rvItem.setLayoutManager(layoutManager);

在侧面ItemAdapter中:-

    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>

0 个答案:

没有答案