具有额外背景的Android警报对话框 [英] Android Alert Dialog with extra background
本文介绍了具有额外背景的Android警报对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我最近将我的应用程序迁移到了Material Design,并且在警告对话框"中偶然发现了这个问题:
I recently migrated my app to Material Design and I stumbled upon this problem with my Alert Dialogs:
我正在像这样应用对话框样式:
I'm applying the dialog style like this:
<item name="android:alertDialogTheme">@style/Theme.AlertDialog</item>
和 Theme.AlertDialog 看起来像这样:
<style name="Theme.AlertDialog" parent="Base.V14.Theme.AppCompat.Dialog">
<item name="colorPrimary">@color/theme_primary</item>
<item name="colorPrimaryDark">@color/theme_primary_dark</item>
<item name="colorAccent">@color/theme_accent_dark</item>
</style>
这是在我的奇巧(Kitkat)设备上发生的,并且在棒棒糖上也可以正常工作.您能帮我摆脱这种外部背景吗?
This is happening on my Kitkat device and it works fine on Lollipop. Can you help me with getting rid of that outer background?
推荐答案
要点在这里:
<style name="Theme.AlertDialog" parent="Base.V14.Theme.AppCompat.Dialog">
...
<item name="colorPrimary">@color/theme_primary</item>
<item name="colorPrimaryDark">@color/theme_primary_dark</item>
<item name="colorAccent">@color/theme_accent_dark</item>
...
<item name="android:windowBackground">@android:color/transparent</item>
...
</style>
这篇关于具有额外背景的Android警报对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文