Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/225.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Android TextView的背景图像上添加一个半透明的黑色层_Android_Background_Drawable_Transparent - Fatal编程技术网

在Android TextView的背景图像上添加一个半透明的黑色层

在Android TextView的背景图像上添加一个半透明的黑色层,android,background,drawable,transparent,Android,Background,Drawable,Transparent,这就是我想做的: 我有一个.png图像作为我的文本视图的背景;文本的颜色为白色。为了使文本更容易阅读,我想在我的.png图像上添加一个表面不透明的黑色层 这就是我到目前为止所做的: <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/aboutContent" android:layout_width="fill_parent" and

这就是我想做的:

我有一个.png图像作为我的文本视图的背景;文本的颜色为白色。为了使文本更容易阅读,我想在我的.png图像上添加一个表面不透明的黑色层

这就是我到目前为止所做的:

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/aboutContent"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical"
      android:text="@string/aboutEN"
      android:textColor="#FFFFFF"
      android:background="@drawable/myimage"/>
但似乎什么也没发生

我该怎么办?谢谢

谢谢


Drawable myimage = getResources().getDrawable(R.drawable.myimage);
myimage.setAlpha(50);
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <ImageView android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="center"
        android:background="@drawable/myimage" />

    <TextView android:id="@+id/aboutContent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:text="@string/aboutEN"
        android:background="#AA000000"
        android:textColor="#ffffff" />