[英]Set button background from style
This is a part of my styles.xml file. 这是我的styles.xml文件的一部分。 For some reason textColor works but background color does not.
由于某些原因,textColor有效,但背景颜色无效。
How do I make it work? 我该如何运作?
<style name="myDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:buttonStyle">@style/myDialogButton</item>
</style>
<style name="myDialogButton" parent="android:style/Widget.Button">
<item name="android:textColor">#0000FF</item>
<item name="android:background">#FF0000</item>
</style>
Use backgroundTint
instead of background
in buttons 使用
backgroundTint
代替按钮中的background
<style name="myDialogButton" parent="android:style/Widget.Button">
<item name="android:textColor">#0000FF</item>
<item name="android:backgroundTint">#FF0000</item>
</style>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.