0
ListViewで押したときに透明な背景を適用しようとしています。私はこのようなファイルlist_selector.xmlを作成します。AndroidアプリケーションでARGBが正常に動作しない
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/argb80804040" />
</selector>
と私のnews_item.xmlで、私は次のようにバックグラウンド定義:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/list_selector">
<ImageView
android:id = "@+id/img"
android:layout_width="95dip"
android:layout_height="75dip"
android:layout_alignParentLeft = "true"
android:paddingTop="10dip"
android:layout_marginLeft="10dip"
android:paddingBottom="10dip"
android:src="@drawable/no_news_image_small" />
<TextView android:id="@+id/title"
android:layout_gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:textSize="12sp"
android:textStyle="bold"
android:paddingTop="5dip"
android:layout_marginLeft="110dip"
android:textColor="#21B6EF"
android:singleLine="true" />
<TextView android:layout_gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:layout_marginLeft="110dip"
android:textSize="10sp"
android:id="@+id/description"
android:layout_below="@id/title"
android:paddingBottom="10dip"
android:layout_marginBottom="5dip"
android:textColor="#fff"/>
</RelativeLayout>
をしかし、それは代わりにARGBカラーのような固体の色を表示します。私の描画可能なものは、次のように定義されています:
<resources>
<item type="drawable" name="transparent_orange">#64ff7b00</item>
<item type="drawable" name="argb80804040">#80804040</item>
<item type="drawable" name="argb40000000">#40000000</item>
<item type="drawable" name="argb80408040">#80408040</item>
</resources>
私は、何か別の作業をする必要がありますか?私は私自身のデバイス(モトローラ無視)にしようとしている、私は同じアルファ色を使用する別のアプリケーションを使用しており、色はこのアプリケーションではOKと思われますが、私の場合、それはdoesntです。任意の応答のための
感謝 T
とターゲットコンテナの属性として結果の描画可能に使用することができます。ここでは例を試してみましたが、色は透明ではありません。 ITは私のアルファ値が働いていないようです。私は透明性のない堅実なオレンジ色を得る。ここにはARGBカラーコードのサンプルがたくさんありますが、透過性が適用されていないため、ARGBカラーとして動作しています。 – Thiago
@Thiago:アンドロイド:background = "@ drawable/the_shape"のTextViewとandroid:background = "#ffffffのLinearLayoutに適用されたシェイプ定義の ")はここで働きます。私たちが働くことができる最小限の例を教えてください。 –
Renaud
私はandroid:background = "@ drawable/list_selector"のRelatyveLayoutを使用していますが、list_selectorの内部には があります。 RelativeLayoutは私のリスト項目の親レイアウト要素です。そのため、透明な背景を適用しています。まだ透明性を得ることはできません。ありがとう@Renaud –
Thiago