0

FrameLayout と 2 つのビューを含むアクティビティがあります。1 つ目は ViewFlipper で、2 つ目は ImageView です。ViewFlipper をコメント アウトすると、アクティビティは ImageView とその背景を正しくレンダリングしますが、ViewFlipper が表示されている場合、ImageView の背景は完全に無視されます。

これは ViewFlipper の「機能」ですか? これを回避する方法はありますか?

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:background="@android:color/background_light"
       >        
    <ViewFlipper android:id="@+id/flipper"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:flipInterval="5000"
       >
                <include layout="@layout/cell_1" android:id="@+id/cell_1"/>
                <include layout="@layout/cell_2" android:id="@+id/cell_2"/>
                <include layout="@layout/cell_3" android:id="@+id/cell_3"/>
   </ViewFlipper>
    <ImageView
        android:background="@drawable/alpha_gradient_background"
        android:id="@+id/statusIcon"
        android:src="@drawable/status_icon"
        android:padding="5dp"
        android:layout_gravity="right"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:top="10dp"
        android:right="10dp"
        />
</FrameLayout> 

そして、私の背景のドローアブルは次のようになります。

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
   android:shape="rectangle">
    <stroke android:width="3dp" android:color="#ffff0000" />
    <gradient
         android:startColor="#66660000"
         android:centerColor="#66006600"
         android:endColor="#66000066"
         android:angle="270" 
    />
</shape>
4

1 に答える 1

0

ViewFlipper の上に配置すると、ボタンは背景をレンダリングできるようです。

したがって、部分的に透明なPNGを作成し、それをボタンの背景画像として設定することで、これを回避しました。

于 2010-10-19T15:48:26.233 に答える