是的,Button的背景默认是由colorPrimary来着色。如果想要使用colorAccent来着色,可以在styles.xml中定义一个新的style,将ButtonStyle的parent设置为Widget.AppCompat.Button.Colored,然后将backgroundTint属性设为colorAccent。
示例代码:
然后在layout.xml中使用这个新的style:
上一篇:ButtonCommand不执行函数
下一篇:button的image和backgroundimage有何不同?分别适用于哪些场景?