gpt4 book ai didi

android - 更改可见性后无触摸事件

转载 作者:太空狗 更新时间:2023-10-29 15:10:34 26 4
gpt4 key购买 nike

我有两个元素的相对布局。其中一个是隐藏的。像这样的东西(为示例简化)

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ImageView
android:id="@+id/fullscreenimage"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<AbsoluteLayout
android:id="@+id/layout_overlay"
android:layout_width="200dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:visibility="gone" >

<ImageView
android:id="@+id/imageView_option1"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_x="0dp"
android:layout_y="0dp"
android:src="@drawable/image1"
android:tag="1" />

<ImageView
android:id="@+id/imageView_option2"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_x="100dp"
android:layout_y="0dp"
android:src="@drawable/image2"
android:tag="2" />
</AbsoluteLayout>
</RelativeLayout>

在全屏图像上检测到长按(而不是抬起手指)后,我想显示这些选项并突出显示用户手指下的选项。我更改了覆盖布局的可见性,但从未调用选项图像上的 touchListeners。尝试从全屏图像的 touchlistener 返回 false,它一直被调用,但从未调用选项图像上的监听器。

最佳答案

ImageViews 通常不可点击,也不会正常触发 onClickListeners,除非您明确将它们设置为可点击。

添加

android:clickable="true"
android:enabled="true"

给他们。

关于android - 更改可见性后无触摸事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16988378/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com