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