0

我有以下几点layout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:clickable="true">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/signsRecycler"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

</RelativeLayout>

波纹管布局是上面的项目recyclerView,在这个布局中我还有另一个recyclerView。如何滚动这个 recyclerView ?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.CardView
        android:id="@+id/cardVisibleLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        card_view:cardElevation="2dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:orientation="horizontal">

            <com.joanzapata.iconify.widget.IconTextView
                android:id="@+id/itxtArrow"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@null"
                android:gravity="center"
                android:text="@string/fa_chevron_down"
                android:textColor="@color/orangePeel" />

            <RelativeLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_gravity="right"
                android:layout_weight="5"
                android:gravity="right"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/txtCategoryName"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="right"
                    android:layout_marginRight="15dp"
                    android:layout_weight="5"
                    android:gravity="center_vertical" />
            </RelativeLayout>
        </LinearLayout>
    </android.support.v7.widget.CardView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/cardVisibleLayout">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/rcyNested"
            android:layout_width="match_parent"
            android:layout_height="125dp" />
    </LinearLayout>

</RelativeLayout>
4

1 回答 1

0

用下面的代码解决了我的问题:

    viewHolder.rcyNested.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            v.getParent().requestDisallowInterceptTouchEvent(true);
            return false;
        }
    });
于 2018-04-11T13:11:27.250 回答