use*_*118 4 android floating-action-button
我试图在fab的其他项目中实现浮动操作按钮并自定义它,它工作正常.但这次,当我在xml布局中创建fab对象时,它显示错误.感到困惑,它试图删除它的一些标签,并发现给出android:backgroundTint标签是错误出现的时候.
这是代码:
<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"/>
Run Code Online (Sandbox Code Playgroud)
这是我的构建:
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.xxxx.xxxx"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "2.0.4"
}
Run Code Online (Sandbox Code Playgroud)
我还添加了谷歌设计gradle.
错误:
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
Run Code Online (Sandbox Code Playgroud)
一旦我删除android:backgroundtint标记,错误就消失了.知道为什么会这样吗?
| 归档时间: |
|
| 查看次数: |
2132 次 |
| 最近记录: |