简体   繁体   English

如何在另一个RecyclerView中滚动RecyclerView-Android

[英]How scroll RecyclerView in another recyclerView - android

I have bellow layout : 我有波纹管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>

And bellow layout is items of above recyclerView , in this layout I have another recyclerView . 波纹管布局是以上recyclerView项,在此布局中,我还有另一个recyclerView How can I scroll this 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>

Resolved my problem with bellow code : 使用以下代码解决了我的问题:

    viewHolder.rcyNested.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            v.getParent().requestDisallowInterceptTouchEvent(true);
            return false;
        }
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM