问题描述
在《第一行代码》(第二版)3.4.1节中引入自定义标题栏时,标题栏按钮没有按照设置的背景颜色显示,
解决方案一
在Button标签中添加:
app:backgroundTint="@null"
这种解决方案其他按钮的默认颜色不会因此改变
ps:贴上stack overflow地址Android Background Drawable Not Working in Button Since Android Studio 4.1
解决方案二
将要改变背景的Button标签改为<android.widget.Button
效果如下
这种解决方案其他按钮的默认颜色不会因此改变
ps:stack overflow地址同上
解决方案三
【android studio】解决Button控件下background背景设置不起作用的问题
此解决方案会使其他未设置背景的按钮变为灰色