我将datepicker添加到应用程序中,但是问题出在对话框的阴影有白色背景,请使用Android 21进行编译。
请帮助我删除白色背景...
您的themes.xml
或styles.xml
材料设计支持库中的“错误”与对话框无法正常工作。
因此,请删除特定的对话框代码或将其分成不同的版本。
试图进一步解释。
通常,当我们扩展原始应用程序主题时,在文件夹下有一个themes.xml
和/或styles.xml
文件values
。在其中的代码中,您将找到以下内容:
应用主题:
<style name="MyTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<!-- ... other styling values ... -->
<!-- Dialog attributes -->
<item name="dialogTheme">@style/MyTheme.Dialog</item>
<!-- AlertDialog attributes -->
<item name="alertDialogTheme">@style/MyTheme.Dialog</item>
<!-- ... other styling values ... -->
</style>
自定义对话框主题:
<style name="MyTheme.Dialog" parent="@style/Theme.AppCompat.Light.Dialog">
<!-- some styling values here -->
</style>
需要自定义的是parent
,MyTheme.Dialog
这可能不适用于所有Android版本,但可能不适用于Lollipop,但不适用于KitKat,反之亦然。Theme.
AppCompat
.Light.Dialog
values-v21
并相应地定义对话框的父级,以便它在两个版本中均适用。您可以应用有关自定义样式的其他一些变通方法,以使其起作用。
如果您想进一步研究,或者主题定制的想法,请在此处查看android theme.xml的源代码。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句