【发布时间】:2015-10-14 06:20:06
【问题描述】:
我已经创建了关于活动的透明片段叠加教程,我想禁用透明片段下方显示的背景活动的触摸事件。所以用户不能从活动中触摸任何东西,只能使用片段帮助教程。
提前谢谢你
【问题讨论】:
标签: android overlay android-fragmentactivity
我已经创建了关于活动的透明片段叠加教程,我想禁用透明片段下方显示的背景活动的触摸事件。所以用户不能从活动中触摸任何东西,只能使用片段帮助教程。
提前谢谢你
【问题讨论】:
标签: android overlay android-fragmentactivity
如果您在设置为全屏的活动上使用片段,即match_parent。然后在片段根布局中,您可以设置属性android:clickable="true" 来消费点击事件。默认情况下,RelativeLayout、LinearLayout 等布局不消耗点击事件。其他视图(例如 Button 和 TextView)默认开启。
在您的叠加片段中。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true">
</RelativeLayout>
【讨论】:
或者只是通过 id 找到片段的父视图...并在其上设置 onClick 侦听器.. 完成。
【讨论】: