【发布时间】:2019-03-26 21:35:00
【问题描述】:
我想更改默认的 AlertDialog 主题。
我发现的例子都没有。这是我正在做的事情:
<style name="LightTheme" parent="Theme.AppCompat.Light.NoActionBar">
...
<item name="alertDialogTheme">@style/MyCustomDialog</item>
</style>
<style name="MyCustomDialog" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:background">#000000</item>
<item name="android:textColor">#FFFFFF</item>
</style>
我是不是做错了什么?
【问题讨论】:
-
在您使用此主题的位置添加布局 (
xml) 或课程代码。 -
这不应该改变整个项目的主题吗?我正在使用
new AlertDialog.Builder(context) -
您的
LightTheme是主应用主题吗(您正在使用例如在 Manifest 中)? -
是的。
android:theme="@style/LightTheme"
标签: android themes android-alertdialog android-theme android-styles