找不到属性'counterEnabled'的资源标识符

时间:2016-03-06 06:54:29

标签: android textinputlayout

  

<android.support.design.widget.TextInputLayout
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/input_email"
    app:counterEnabled="true"
    app:counterMaxLength="10"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <EditText
        android:id="@+id/email"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/email_hint"
        android:ems="10"
        android:inputType="textEmailAddress"/>

</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
    android:id="@+id/input_password"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <EditText
        android:id="@+id/password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/password_hint"
        android:inputType="textPassword"/>

</android.support.design.widget.TextInputLayout>

<Button
    android:id="@+id/button_save"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/save"
    android:layout_gravity="end"/>

<TextView
    android:id="@+id/success"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="@string/success"
    android:visibility="gone"/>

问题是什么?我在我的gradle文件中编译'com.android.support:appcompat-v7:22.2.0',也编译'com.android.support:design:22.2.0'。为什么这不起作用?为什么我会得到这个奇怪的错误?

1 个答案:

答案 0 :(得分:3)

我认为'com.android.support:design:22.2.0'中的问题, 因为当我使用'com.android.support:design:23.0.1'时,我遇到了同样的问题。找不到属性'counterEnabled'的资源标识符, 将'com.android.support:design:23.0.1'更改为'com.android.support:design:23.1.1',此问题已解决。

the location of attribute '23.1.1'

the location of attribute '23.0.1'