0

我要这个。注意显示文本(即说明)的透明层。还要检查背景一个木制的背景。

在此处输入图像描述

我试过这个但没有得到想要的结果

 <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_margin="10dp"
                android:alpha="0.75" >

                <TextView
                    android:id="@+android:id/txtInstructions"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+android:id/relImagesLogo"
                    android:layout_centerInParent="true"
                    android:lineSpacingMultiplier="1.5"
                    android:text="Lorem Ipsum is simply dummy text of 

                    the printing and typesetting industry. Lorem Ipsum has been the 

                    industry&apos;s standard dummy text ever since the 1500s, when an                      unknown 

                    printer took a galley of type and scrambled it to make a type specimen 

                    book. It has survived not only five centuries, but also the leap into 

                    electronic typesetting, remaining essentially unchanged. It was popularised "
                    android:textColor="@android:color/white"
                    android:textSize="14sp" />

                <RelativeLayout
                    android:id="@+android:id/relImagesLogo"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:layout_centerHorizontal="true" >

                    <ImageView
                        android:id="@+android:id/imgInstructionLogo"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:layout_marginRight="2dp"
                        android:src="@drawable/instruction_icon" />

                    <ImageView
                        android:id="@+android:id/imgInstructionHeading"
                        android:layout_width="wrap_content"
                        android:layout_height="30dp"
                        android:layout_centerVertical="true"
                        android:layout_toRightOf="@+android:id/imgInstructionLogo"
                        android:src="@drawable/instruction_heading" />
                </RelativeLayout>
            </RelativeLayout>

请注意,这android:alpha="0.75"会使我的所有视图对 0.75 级透明。我不想要这个。我只想要那个透明层。

知道我得到了这个结果

在此处输入图像描述

4

3 回答 3

2


尝试:

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_margin="10dp"
        android:background="#66FF0000" >

可以看到: android:color="#66FF0000" // 部分透明红色

我建议您检查以下信息: Android set alpha opacity for a custom view

Android 并为(图像)视图 alpha 设置 alpha

于 2013-02-20T08:57:53.030 回答
2

您需要将最外层布局的背景设置为可绘制的木材。并将文本视图的背景设置为透明颜色。试试这个:

<RelativeLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:background="#FF008833" >

<TextView
    android:id="@+android:id/txtInstructions"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="30dp"
    android:layout_below="@+android:id/relImagesLogo"
    android:layout_centerInParent="true"
    android:lineSpacingMultiplier="1.5"
    android:background="#BB000000"

    android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&apos;s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised "
    android:textColor="@android:color/white"
    android:textSize="14sp" />
</RelativeLayout>
于 2013-02-20T09:13:03.583 回答
1

xxyyyyy

xx 是您的透明度级别,y 是您的颜色。

xx 最大值是:ff // 这是完全可见的

xx min value is : 00 // 这是完全不可见的

编辑:顺便说一句,我们在 android:background="xxyyyyyy" 中使用这些代码

于 2014-02-27T14:24:41.337 回答