【问题标题】:How to Create a Transparent over another View in android?如何在android中的另一个视图上创建透明?
【发布时间】:2012-12-13 18:10:00
【问题描述】:

我想在我的活动上创建一个透明视图。单击选项卡会显示活动。我想要的是,一旦我单击活动中的任何图像,透明视图就会覆盖在活动上,但我的选项卡仍然可单击。此外,当创建透明视图时,活动的背景项目不应该是可点击的。可能吗? 以及如何在android中实现这一点?

【问题讨论】:

    标签: android android-layout android-widget


    【解决方案1】:
        //test.xml
    
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/ic_launcher"
        android:orientation="vertical" >
       <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@android:color/transparent"
        android:orientation="vertical" > 
    </LinearLayout>
    </LinearLayout>
    

    【讨论】:

      【解决方案2】:

      这允许覆盖的图像通过点击传递到它下面的任何按钮:

      <ImageView
          ...
          android:clickable="false"
          ...
          />
      

      (当它设置为 true 时,ImageView 会获得所有点击)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-01-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-01-21
        相关资源
        最近更新 更多