Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
按钮android:Background="&引用;到@drawable资源_Android_Xml_Kotlin_Button_Themes - Fatal编程技术网

按钮android:Background="&引用;到@drawable资源

按钮android:Background="&引用;到@drawable资源,android,xml,kotlin,button,themes,Android,Xml,Kotlin,Button,Themes,我正在尝试将按钮背景从主题原色替换为图像(png)。 但是无论我用什么替换“android:background”属性,它总是用我的主题原色填充。我怎样才能改变这个 这是我的按钮的代码: <Button android:id="@+id/button_first" android:layout_width="100dp" android:layout_height="100dp"

我正在尝试将按钮背景从主题原色替换为图像(png)。 但是无论我用什么替换“android:background”属性,它总是用我的主题原色填充。我怎样才能改变这个

这是我的按钮的代码:

<Button
        android:id="@+id/button_first"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="@drawable/myapp_logo_plain"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

如果您需要更多信息或其他代码,欢迎您索取:)


提前感谢

使用ImageButton并添加
app:srcCompat=“@drawable/ic_image”
谢谢你的帮助