水平滚动视图中的Recycler视图在android oreo中不起作用,但在以下版本中可以完美工作

水平滚动视图中的Recycler视图在android oreo中不起作用,但在以下版本中可以完美工作,android,android-recyclerview,horizontalscrollview,Android,Android Recyclerview,Horizontalscrollview,下面的代码不适用于oreo版本的android,但适用于其他版本。我正在尝试使用水平滚动视图。在这种情况下,用户必须能够发表评论,其他评论通过recycler视图显示。因此,我在这段代码中有一个问题,仅适用于新版android。有人能就这个问题向我提些建议吗。 这是密码 <HorizontalScrollView android:layout_width="match_parent" android:layout_height="wrap_content" andr

下面的代码不适用于oreo版本的android,但适用于其他版本。我正在尝试使用水平滚动视图。在这种情况下,用户必须能够发表评论,其他评论通过recycler视图显示。因此,我在这段代码中有一个问题,仅适用于新版android。有人能就这个问题向我提些建议吗。 这是密码

<HorizontalScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:scrollbars="none">
    <LinearLayout
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:orientation="horizontal">
        <FrameLayout
            android:layout_width="200dp"
            android:layout_height="175dp"
            android:layout_marginStart="10dp"
            android:layout_marginEnd="5dp"
            android:background="@layout/button_background"
            android:layout_marginTop="15dp"
            >
            <de.hdodenhof.circleimageview.CircleImageView
                android:id="@+id/userfbpic1"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_marginTop="10dp"
                android:layout_alignParentStart="true"
                android:layout_alignParentTop="true"
                android:layout_marginStart="15dp"
                android:src="@drawable/bg"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/current_username"
                android:text="@string/current_username_forcomment"
                android:layout_marginTop="12dp"
                android:layout_marginStart="50dp"
                android:textStyle="bold"
                android:textColor="@color/background"
                android:textSize="15sp"
                />
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="60dp">
                <EditText
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/background"
                    android:id="@+id/comments"
                    android:textSize="15sp"
                    android:hint="comment here"
                    android:imeOptions="actionDone"
                    android:singleLine="true"
                    android:textStyle="bold"
                    android:background="@android:color/transparent"
                    />
            </LinearLayout>
        </FrameLayout>
            <android.support.v7.widget.RecyclerView
                android:id="@+id/recyclerview_comments"
                android:layout_width="wrap_content"
                android:nestedScrollingEnabled="false"
                android:layout_marginTop="15dp"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
            </android.support.v7.widget.RecyclerView>
   </LinearLayout>
</HorizontalScrollView>


当你将
回收视图
放在一个方向相同的
滚动视图
中时,
回收视图
将扩展,在
滚动视图
中膨胀并将其所有的子对象都放出来。拖动视图时,
RecyclerView
会使用触摸事件,
ScrollView
不会滚动,除非禁用
RecyclerView
touch..

在RecyclerView上的触摸监听器中添加以下代码

recyclerview.addOnItemTouchListener(新的recyclerview.OnItemTouchListener()
{
@凌驾
公共布尔值onInterceptTouchEvent(RecyclerView rv,MotionEvent e){
int action=e.getAction();
开关(动作){
case MotionEvent.ACTION\u移动:
rv.getParent().RequestDisallowWinterCeptTouchEvent(true);
打破
}
返回false;
}

});那你是怎么做到的?@如果我的建议是将回收器中的所有其他视图作为标题视图移动,您将从更好的性能和更少的内存使用中获益。除此之外,您还可以扩展recyclerView并覆盖touch事件,尽管这在性能上很糟糕。您是否看到子项单击时间父项滚动禁用。我的意思是回收器视图单击或拖动事件u do parent horizontal scroll view scroll set false那么它就工作了。例如请?v.getParent()。requestDisallowWinterCeptTouchEvent(true);这对我不起作用。我能得到更多的建议吗