1

我需要为我的应用程序中的每个活动设置背景颜色。我宁愿在全球范围内设置它。出于这个原因,我更改了设置为应用程序主题的样式。

<resources xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
        <item name="android:background">@color/app_bg</item>
    </style>
</resources>

问题是现在所有没有指定背景的 ImageViews 和 TextViews 都获得了应用程序背景,而不是父 Layout 的背景,例如

<RelativeLayout 
    android:id="@+id/mmc_rl"
    android:layout_width="match_parent"
    android:layout_height="@dimen/mm_central_height"
    android:background="@color/main_menu_central_bg"> 

    <ImageView
        android:id="@+id/mmc_iv_goto"
        android:layout_width="@dimen/mm_central_height"
        android:layout_height="@dimen/mm_central_height"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:src="@drawable/button_goto_big3"  />

</RelativeLayout>

ImageView 有背景app_bg而不是main_menu_central_bg预期的那样。我怎么解决这个问题?

4

1 回答 1

1

在 ImageView xml 中包含这一行:

android:background="@android:color/transparent"
于 2013-03-05T10:31:49.197 回答