Search code examples
androidandroid-recyclerviewsmooth-scrolling

Recyclerview not scrolling after overlay view is removed


I have the following layout.

<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>

Based on an event I make the vertical recycler view visible and gone.

Problem: Horizontal recyclerview stops smooth scrolling as soon as the following is performed. Horizontal scroll view alpha is changed from 1 - 0 - 1 and vertical rcv goes from GONE - VISIBLE - GONE.

I still get the touch event for horizontal rcv in onInterceptTouchEvent by adding addOnItemTouchListener but the scrolling seems to stutter.

Any thoughts?


Solution

  • From my comments,

    Instead of View Gone set the height to 0dp instead