2011-11-13 10 views
2

を背景画像の上に半透明の黒色層を追加します。これは私がやろうとしているものです:は、AndroidのTextViewで

私は私のTextViewの背景としての.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"/> 

私はアンドロイドを追加しようとしました:背景=「@カラー/ blackOpaque」> しかし、Eclipseは、私はすでに背景イメージを持っていることを訴えます。だから、画像ファイルの透明度を次のように変更しようとしました:

Drawable myimage = getResources().getDrawable(R.drawable.myimage); 
myimage.setAlpha(50); 

何も起こっていないようです。

どうすればよいですか?ありがとう!

ありがとうございます!

答えて

1

This saved my @$$!

<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" />