1

次のようにAndroidManifest.xmlでを定義して、アプリのテーマを適用しました。android:theme

AndroidManifest.xml:

<application
        android:label="@string/app_name"
        android:theme="@style/Theme.MyTheme" >
        <activity
            android:name=".MainActivity"
            ...
            ...
        </activity>
        ...
</application>

themes.xmlで:

<style name="Theme.MyTheme" parent="@android:style/Theme.Holo">
   <item name="android:windowBackground">@drawable/blue_bg_img</item>
</style>

上記の でわかるようにMyTheme、アプリとして青色の画像を適用しましたwindowBackground。したがって、私のアプリのすべてのビュー要素には、この青色の画像の背景があります。

しかし、この blue を使用したくない ImageView 要素が 1 つありますwindowBackground。代わりに、透明な背景を使用したいと考えています。私がしようとしました:

myImageView.setBackgroundColor(Color.TRANSPARENT);

しかし、私のアプリのテーマで定義された青い画像はまだ表示されています。定義したアプリのテーマをオーバーライドできないようです。アプリ内の 1 つの View 要素のテーマをオーバーライドするにはどうすればよいですか ???

4

2 に答える 2

0

Finally, I managed to solve this problem myself by decreasing the height of my ImageView element until the blue background is not visible. If other people have other solutions, I am very pleased to see.

于 2012-10-05T09:31:07.387 に答える
0

画面の背景が青色の場合、ImageView の背景を透明に設定すると、青色になります! 黒、またはその他の予想される色に設定してみてください。

于 2012-10-05T08:57:25.570 に答える