<android.support.design.widget.FloatingActionButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/insert_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/add"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
android:layout_alignBottom="@id/list_view"
android:layout_alignRight="@id/list_view"
android:background="#649696"
/>
这段代码没问题,但是在两行后面添加就崩溃了
android:backgroundTint="#649696"
app:rippleColor="#FFFFFF"
崩溃日志:
在 Android 4.1 之前,方法 android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) 会不正确重写 android.graphics.drawable.Drawable 中的包私有(private)方法 I/FloatingActionButton:不支持设置自定义背景。
等级依赖:
compileSdkVersion 27
defaultConfig {
applicationId ""
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
谁能告诉我如何解决这个问题
最佳答案
不幸的是,如果您甚至不设置背景或色调,也会显示此警告。但是,要摆脱它,您可以设置属性 android:background="@null"
,这将根据 official materials github repository 中的用户建议忽略它。 。 (此问题的原因是一个内部问题,其中一些 setter 被调用,这可能会在 Material 设计库的 future 版本中修复)
关于android - float 操作按钮 : Setting a custom background is not supported,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47951471/