【发布时间】:2018-01-15 04:46:05
【问题描述】:
我为我的应用使用了内置主题 Theme.AppCompat.NoActionBar。但它给出了完整的黑色背景。我想将此黑色背景更改为灰色。所以我尝试自定义我的主题如下:
这是我的styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="MyTheme"> // Using Customized theme.
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
//Customize the Theme.
<style name="MyTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:backgroundDimAmount">0.8</item>
</style>
这里我想减轻我的背景颜色,所以我使用android:backgroundDimAmount,但它不起作用。
我还使用了以下内容:
<style name="MyTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:background">#707070</item>
</style>
这会改变背景颜色,但会给我以下屏幕截图的奇怪结果:
我的实际活动如下图所示:
所以我的问题是如何减轻或改变背景颜色?
【问题讨论】: