当前位置: 首页 > 知识库问答 >
问题:

RecyclerView没有获得触摸事件,因为上面有另一个LinearLayout(有时)

公冶同
2023-03-14

我有一个回收视图,可以接触事件。一切正常,但是,当我创建<code>可见性时。可见aLinearLayoutandroid:clickable=“true”)位于Recyclerview上方,之后我使其可见。消失。然后,回收视图不会获取触摸事件。我能做什么?

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

tip_container是有问题的布局,当visibility.visible时,甚至当一旦显示visibility.gone.时,它会吞下RecyclView触摸事件

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

共有1个答案

焦同
2023-03-14

尝试在文件底部添加您的RecyclerView标记并检查!

 类似资料:
  • 本文向大家介绍React的触摸事件有哪几种?相关面试题,主要包含被问及React的触摸事件有哪几种?时的应答技巧和注意事项,需要的朋友参考一下 onTouchCancel onTouchEnd onTouchMove onTouchStart

  • 在JavaScript中,我按住两个键,并且被完美触发。当我释放其中一个键时,被触发。到目前为止一切都很好。但是我仍然按住一个键,那么为什么没有被触发呢?我需要在我的游戏中发生这种情况。我做错了什么吗?这是预期的反应吗?有什么解决办法吗?

  • 本文向大家介绍iOS UIView的Touch事件有哪几种触摸事件?相关面试题,主要包含被问及iOS UIView的Touch事件有哪几种触摸事件?时的应答技巧和注意事项,需要的朋友参考一下 处理事件的方法 UIView是UIResponder的子类,可以覆盖下列4个方法处理不同的触摸事件  

  • 触摸操作概述 浏览器的触摸 API 由三个部分组成。 Touch:一个触摸点 TouchList:多个触摸点的集合 TouchEvent:触摸引发的事件实例 Touch接口的实例对象用来表示触摸点(一根手指或者一根触摸笔),包括位置、大小、形状、压力、目标元素等属性。有时,触摸动作由多个触摸点(多根手指)组成,多个触摸点的集合由TouchList接口的实例对象表示。TouchEvent接口的实例对

  • 在libGDX中的Box2d的帮助下,我让各种身体以一定角度旋转。我想要的是当我点击身体时破坏它,但问题是我无法获得身体的区域定义,这样我就可以检查我的接触点是否位于身体内部。我试过使用actor及其hit()方法,但只有在我不旋转它的情况下,它才会起作用。据我所知,一旦我旋转了身体,它的边界就不会旋转。那么,我们如何检查身体中的触摸事件呢。提前谢谢。

  • 我在库伯内特斯连夜运行了一项工作。当我早上检查它时,它已经失败了。通常,我会检查pod日志或事件来确定原因。然而,pod被删除了,没有事件。 下面是输出: 这是作业配置yaml。它有,但是它从来没有重启过。我也没有设置TTL,所以豆荚永远不会被清理。 我如何调试这个?