【发布时间】:2017-10-08 01:02:21
【问题描述】:
我有一个与主题相关联的活动(在 AndroidManifest.xml 中)
<activity
android:name=".BenchTestActivity"
android:parentActivityName=".HomeActivity"
android:theme = "@style/AppTheme.CaeTheme">
AppTheme.CaeTheme 不包含任何内容(目前),但 AppTheme 是:
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:background">@color/colorPrimary</item>
</style>
(colorPrimary 为深蓝色)
现在我在上述活动中定义了一个progressDialog。
progressDialog = new ProgressDialog(BenchTestActivity.this);
progressDialog.setProgressStyle(R.style.ProgressDialog);
这里是 ProgressDialog 样式:
<style name="ProgressDialog">
<item name="android:alertDialogStyle">@style/CustomAlertDialogStyle</item>
<item name="android:layout_centerHorizontal">true</item>
<item name="android:layout_centerVertical">true</item>
<item name="android:visibility">gone</item>
</style>
<style name="CustomAlertDialogStyle">
<item name="android:background">@color/colorBackgroundProgressDialog</item>
<item name="android:textColorPrimary">#e6e6e6</item>
</style>
colorBackgroundProgressDialog 是浅灰色。我期待获得该颜色作为我的进度对话框的背景,但事实并非如此(背景颜色是深蓝色,colorPrimary)。因此,活动主题的背景是获胜的。那么,如何为进度对话框设置自定义颜色?
提前致谢。
【问题讨论】:
-
是的,由于活动应用的主题,请再次检查
-
我知道。但是我怎样才能正确设置呢?我需要活动的主题。自定义progressDialog的背景有什么方法?
标签: java android android-layout android-view progressdialog