0
我有以下布局。删除重叠视图后Recyclerview不滚动
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
<android.support.v7.widget.RecyclerView
android:id="@+id/horizontal_rcv"
android:layout_width="match_parent"
android:layout_height="90dp"
android:alpha="1.0"
android:padding="@dimen/dimen_16"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/vertical_rcv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.0"
android:padding="@dimen/dimen_16"/>
</RelativeLayout>
根据一个事件,我使垂直回收视图可见和消失。
问题: 只要执行以下操作,Horizontal recyclerview将停止平滑滚动。水平滚动视图alpha从1 - 0 - 1更改,垂直rcv从GONE - VISIBLE - GONE。
我仍然通过添加addOnItemTouchListener来获取onInterceptTouchEvent中的水平rcv的touch事件,但滚动似乎是口吃。
有什么想法?
的arent那些2 RecyclerView的overlaping?另一个是android:layout_height =“90dp”,另一个是android:layout_height =“match_parent”。也许它更好,如果你把它包装在一个Framelayout。无论如何,你有没有尝试将高度设置为0dp而不是视图消失。我从来没有尝试过,但可能会工作 – Tasos
他们应该重叠,一次只有一个应该是可见的。 FrameLayout如何提供帮助? – PravinCG
使用FrameLayout时,它将重叠而不会干扰其下方的视图。 Ty,并将高度设置为0dp,以获取需要去看的视图而不是View GONE。看看这是不是与滚动 – Tasos