当前位置: 首页 > 知识库问答 >
问题:

带有背景色彩的浮动操作按钮导致错误

文凯康
2023-03-14
    <android.support.design.widget.FloatingActionButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:fabSize="mini"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:src="@drawable/ic_action_fab"
    android:backgroundTint="#2196F3"
    android:layout_margin="12dp"/>
compileSdkVersion 25
buildToolsVersion '25.0.0'

defaultConfig {
    applicationId "com.xxxx.xxxx"
    minSdkVersion 10
    targetSdkVersion 23
    versionCode 1
    versionName "2.0.4"
}
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxxx.xxxx/com.xxxx.xxxx.HomeActivity}: android.view.InflateException: Binary XML file line #141: Binary XML file line #141: Error inflating class android.support.design.widget.FloatingActionButton

当我移除Android:BackgroundTint标记时,错误就消失了。知道为什么会这样吗?

暂时还没有答案

 类似资料:
  • 我对改变晶圆厂的背景色有一个问题,似乎晶圆厂后面有另一个背景 这是我的代码 现在唯一有效的解决方案是改变我的应用程序上的颜色口音,但它会影响其他UI元素

  • Floating Action Button is supported only in Material Theme Floating action buttons are used for a promoted action. They are distinguished by a circled icon floating above the UI and have motion behavi

  • 当使用浮动动作按钮时,我的Android应用程序崩溃并抛出错误。当我移除它时,我的应用程序成功运行,但如果可以的话,我宁愿使用浮动动作按钮。 这是我的完整错误日志:

  • 问题内容: 我一直在尝试更改Material的“浮动动作按钮”的颜色,但没有成功。 我尝试添加: 或通过代码: 要么 但以上方法均无效。我也尝试过提出的重复问题中的解决方案,但是没有一个起作用。按钮保持绿色,并且也变成了正方形。 PS知道如何添加波纹效果也很高兴,也无法理解。 问题答案: 如文档中所述,默认情况下,它采用在styles.xml属性colorAccent中设置的颜色。 该视图的背景色

  • 我的应用程序出现了这个错误

  • 浮动操作按钮 运行方式 过渡 大屏幕 浮动操作按钮 浮动操作按钮 浮动操作按钮适用于进阶的操作。它是漂浮在 UI 上的一个圆形图标,具有一些动态的效果,比如变形、弹出、位移等等。 浮动操作按钮有两种尺寸: 默认尺寸:适用于多数应用情况。 迷你尺寸:仅用于创建与其他屏幕元素视觉的连续性。 浮动操作按钮 迷你浮动操作按钮 浮动操作按钮应至少放在距手机边缘 16dp 或电脑/台式机边缘 24dp 的地方