【发布时间】:2017-09-11 07:34:09
【问题描述】:
当我在 API 级别 24 以下运行代码时遇到此异常。
致命异常:主进程:com.example.scanwithanimations, PID:13393 java.lang.RuntimeException:无法启动活动 组件信息{com.example.scanwithanimations/com.example.scanwithanimations.MainActivity}: android.view.InflateException:二进制 XML 文件第 14 行:错误 膨胀类
android.support.design.widget.FloatingActionButton
我的main.xml如下。
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingTop="16dp">
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginRight="16dp"
android:layout_marginBottom="164dp"
android:src="@drawable/ic_action_wifi"
android:elevation="6dp"
android:id="@+id/fabwifi"
app:pressedTranslationZ="12dp"
android:backgroundTint="@color/fab1"
android:visibility="invisible"
/>
</android.support.design.widget.CoordinatorLayout>
【问题讨论】:
-
它的 JNE (java.lang.NullPointerException) 我的朋友
-
@NileshRathod 但它工作正常 API 26...
-
@NileshRathod Thnx... 我忘了在一个地方进行更改。现在工作正常。非常感谢您的帮助...
-
@NileshRathod 完成....谢谢...
标签: android android-layout floating-action-button