Android材质UI无法更改背景
我最近把我的Gradle版本升级到了6.5版本,现在我得到了一种新的格式。 values.xml替换为2个Android材质UI无法更改背景,android,android-studio,gradle,Android,Android Studio,Gradle,我最近把我的Gradle版本升级到了6.5版本,现在我得到了一种新的格式。 values.xml替换为2个主题.xml。当我转到activity\u main.xml时,我无法更改按钮的背景颜色。 以下是我的XML: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="ht
主题.xml
。当我转到activity\u main.xml
时,我无法更改按钮的背景颜色。
以下是我的XML:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#000000"
android:text="Button"
tools:layout_editor_absoluteX="41dp"
tools:layout_editor_absoluteY="195dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
我把我的android studio升级到4.1版,它改变了Gradle版本。
当我降级我的Gradle版本时,它不允许降级。
请帮忙 您可以简单地为API级别21及更高添加android:backgroundTint
,或为API级别7及更高添加app:backgroundTint