首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >安卓-透支布局允许通过LinearLayout进行触摸

安卓-透支布局允许通过LinearLayout进行触摸
EN

Stack Overflow用户
提问于 2012-04-13 01:57:41
回答 3查看 18.7K关注 0票数 18

在下面的UI中,我让下面的内容可拖动,覆盖整个屏幕。LinearLayout是透明的,并且允许它下面的控件是可点击或可触摸的。基本上,我可以滚动此LinearLayout下面的列表以及单击控件。我如何禁用它?

请参阅附加的示例。

谢谢

代码语言:javascript
复制
<RelativeLayout
     xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/rlExtNavbar" 
    android:orientation="vertical"
    android:layout_width="match_parent" 
    android:layout_height="match_parent"
    android:gravity="fill_vertical"
    android:layout_gravity="fill_vertical"
    android:background="@color/transparent" xmlns:tools="http://schemas.android.com/tools" tools:ignore="Overdraw">
    <RelativeLayout
        android:id="@+id/expandedNavbarLayout" 
        android:orientation="vertical"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" >
    </RelativeLayout>
    <LinearLayout
        android:id="@+id/transparentLayout" 
        android:orientation="vertical"
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"
        android:layout_below="@id/expandedNavbarLayout"
        android:focusableInTouchMode="false"
        android:focusable="false"
        android:background="@color/fulltransparent">
    </LinearLayout>

</RelativeLayout>
EN

回答 3

Stack Overflow用户

发布于 2012-04-22 09:53:06

只需在XML中为LinearLayout设置android:clickable="true"属性就可以防止单击通过--不需要单击侦听器。

票数 115
EN

Stack Overflow用户

发布于 2012-04-13 05:12:53

给线性布局分配了一个点击并解决了这个问题。老实说,它一开始就不应该这样工作,但这解决了问题。单击为空。

票数 2
EN

Stack Overflow用户

发布于 2014-07-04 22:18:37

对我来说起作用的是在xml中将LinearLayout放在内部RelativeLayout之前。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10129092

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档