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

时间:2016-02-03 18:41:18

标签: android xml android-studio

我正在使用Android Studio 当我试图运行我的应用程序时,我收到以下错误:

android.view.InflateException: Binary XML file line #23: Error inflating class android.support.v7.design.widget.TextInputLayout

我的.xml文件:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fitsSystemWindows="true"
android:fillViewport="false">

<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="56dp"
    android:paddingLeft="24dp"
    android:paddingRight="24dp">

    <android.support.v7.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="8dp">
        <EditText android:id="@+id/input_email"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textEmailAddress"
            android:hint="Email" />
    </android.support.v7.design.widget.TextInputLayout>

    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="8dp">
        <EditText android:id="@+id/input_password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:hint="Password"/>
    </android.support.design.widget.TextInputLayout>
</LinearLayout>

我编译的sdk版本是22。 有什么建议吗?
谢谢!!

2 个答案:

答案 0 :(得分:1)

您应该使用android.support.design.widget.TextInputLayout而不使用v7

答案 1 :(得分:1)

不应该是

android.support.v7.design.widget.TextInputLayout

应该是

android.support.design.widget.TextInputLayout