新建了一個項目,發現button的backgroud不起作用,預覽沒有效果,運行到真機也是一樣。
基本上可以肯定是樣式的問題,解決:
Theme.MaterialComponents.DayNight.DarkActionBar加個.Bridge就可以了。
其實解決方法也是很多的,只要把application中的樣式換一個就可以了。
src/main/AndroidManifest.xml
android:theme="@style/Theme.AppCompat"
參考:
https://blog.csdn.net/qq_29761395/article/details/112198510