android.view.InflateException:二进制XML文件行#31:错误膨胀类android.support.design.widget.FloatingActionButton

时间:2017-03-24 11:41:07

标签: android

每当我尝试将FloatingActionButton添加到我的应用程序时,我都会收到InflateException。 这是我的XML:

<FrameLayout 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"
    tools:context="wtw.sunonetaji.landing.MainScreenListActivity">
    <LinearLayout
        android:id="@+id/activity_main_screen_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context="wtw.sunonetaji.landing.MainScreenListActivity">
        <include
            android:id="@+id/toolbar"
            layout="@layout/toolbar" />
        <android.support.v7.widget.RecyclerView
            android:id="@+id/recycler_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scrollbars="vertical" />
    </LinearLayout>
    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|right"
        android:layout_margin="16dp"
        android:backgroundTint="@color/bgcoloor"
        android:clickable="true"
        android:padding="10dp"
        android:src="@drawable/pencileditbutton"
        app:borderWidth="1dp" />
</FrameLayout>

这是我的例外:

Caused by: android.view.InflateException: Binary XML file line #31: Error inflating class android.support.design.widget.FloatingActionButton

2 个答案:

答案 0 :(得分:2)

试试这种方式

    NameError                                 Traceback (most recent call last)
    <ipython-input-18-e096b2eea097> in <module>()
         1 DiscretiseEquation(200)
   ----> 2 A = mat
         3 b = rhs
         4 x_200, info_200 = gmres(A, b, callback = IterCount())
         5 gmres_res =  closure_variables["residuals"]

   NameError: name 'mat' is not defined

答案 1 :(得分:0)

gradle

中添加设计支持库
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'