今天在练习Android自定义控件的时候遇到了一个问题:我给button设置了一个背景,却无法修改,但是给Layout设置了一个背景却可以成功修改。
如下图,我给back Button了一个图案,放到了对应的drawable-xxhdpi文件夹中,并附上对应的xml语句,却不能成功的显示出图片的形状解决方案
(1)打开main/res/values/theme.xml文件
(2)将里面的<style name="Theme.UICustomViews" parent="Theme.MaterialComponents.DayNight.DarkActionBar">修改为<style name="Theme.UICustomViews" parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge">