RecyclerView не получает события касания, потому что выше (иногда) есть еще один LinearLayout

У меня есть RecyclerView, который получает события касания. Все работает нормально, но, когда я делаю Visibility.Visible LinearLayout (android:clickable="true") над Recyclerview, а позже я делаю его Visibility.Gone. Тогда recyclerView не получает события касания. Что я могу сделать?

    mTipContainer.setVisibility(View.GONE);
    mTipContainer.setClickable(false);
    mTipContainer.setOnClickListener(null);

tip_container — это проблемный макет, который поглощает RecyclerView сенсорных событий, когда visibility.visible, и даже когда когда-то показано, что 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>


person X.Otano    schedule 25.08.2016    source источник
comment
можете ли вы опубликовать какой-нибудь код. Чтобы было легко решить проблему   -  person Dinesh Sunny    schedule 25.08.2016
comment
слишком много кода...   -  person X.Otano    schedule 25.08.2016
comment
установите clickable false, когда вы устанавливаетеvisibilty.gone   -  person JAAD    schedule 25.08.2016
comment
посмотрите правки, пожалуйста, я пробовал   -  person X.Otano    schedule 25.08.2016
comment
это не полный xml, пожалуйста, опубликуйте полный xml   -  person JAAD    schedule 25.08.2016
comment
Попробуйте добавить свой recyclerview внизу и проверьте!   -  person Dinesh Sunny    schedule 25.08.2016
comment
Это было решением!!! Я только что попробовал, проблема заключалась в порядке внутри контейнера обоих макетов ‹android.support.v4.widget.DrawerLayout›   -  person X.Otano    schedule 25.08.2016


Ответы (1)


Попробуйте добавить свой тег RecyclerView внизу файла и проверьте!

person Dinesh Sunny    schedule 25.08.2016