I have a RecyclerView
that gets touch events.
Everything works fine, but, when I make Visibility.Visible
a LinearLayout
(android:clickable="true"
) above the Recyclerview
, and later I make it Visibility.Gone
.Then the recyclerView
does not gets the touch events.
What can I do?
mTipContainer.setVisibility(View.GONE);
mTipContainer.setClickable(false);
mTipContainer.setOnClickListener(null);
tip_container
is the problematic Layout, that swallows RecyclerView
touch events when visibility.visible
, and even when once shown is visibility.gone.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/DrawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:fancy="http://schemas.android.com/apk/res-auto"
android:elevation="7dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/tool_bar"
layout="@layout/tool_bar"
>
</include>
<FrameLayout android:id="@+id/contenedor" android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/RecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#ffffff"
android:scrollbars="vertical">
</android.support.v7.widget.RecyclerView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#313131"
android:id="@+id/tip_container"
android:visibility="gone"
android:layout_margin="0dp"
android:padding="0dp"
>
<ImageView
android:id="@+id/tip_drawable"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"
android:src="@drawable/tip_minutos"/>
<ImageView
android:id="@+id/tip_close"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="10dp"
android:src="@drawable/cross_close"
android:scaleType="centerInside"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:clickable="true"
android:tint="@color/white"
android:layout_marginTop="40dp"/>
<mehdi.sakout.fancybuttons.FancyButton
android:id="@+id/tip_boton_continuar"
android:layout_width="match_parent"
android:layout_height="55dp"
fancy:fb_textSize="14sp"
android:paddingBottom="8dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="8dp"
fancy:fb_defaultColor="#00000000"
fancy:fb_focusColor="@color/BotonVerdeFocus"
fancy:fb_radius="0dp"
fancy:fb_borderWidth="1dp"
fancy:fb_borderColor="#ffffff"
fancy:fb_text="Continuar"
fancy:fb_textColor="@color/white"
android:fontFamily="sans-serif"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:visibility="visible"/>
</RelativeLayout>
Try to add your RecyclerView tag at the bottom of the file and check!