【发布时间】:2015-12-12 12:50:17
【问题描述】:
有没有办法改变AlertDialog(android.support.v7.app.AlertDialog)的标题背景颜色?? 目前在我的主题中我有
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/colorAccent</item>
</style>
我是这样理解的,
我怎样才能让它看起来像这样,
使用
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowTitleStyle">@style/DialogTitle</item>
</style>
<style name="DialogTitle">
<item name="android:background">@color/colorPrimary</item>
</style>
给予
关于如何实现这一点的任何想法?
【问题讨论】:
-
你找到解决办法了吗?
-
我觉得松国先生的回答是最好的回答stackoverflow.com/a/42135263/7797592
-
看起来
setCustomTitle()是唯一的方法。 -
@Hunt 我在下面发布了我的答案。
标签: android android-alertdialog android-theme