4

I'm trying to use TextInputEditText in my XML, and I'm meeting this error :

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

Caused by: java.lang.ClassNotFoundException: Didn't find class 
"android.support.design.widget.TextInputEditText" on path: 
DexPathList[[zip file "/data/app/thanhnguyen.com.familysharinglocation-
1/base.apk"],nativeLibraryDirectories=
[/data/app/thanhnguyen.com.familysharinglocation-1/lib/arm64, 
/system/lib64, /vendor/lib64]]

Here my xml :

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

    <android.support.design.widget.TextInputEditText
        android:hint="@string/fullName"
        android:inputType="textCapWords"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>

My dependency :

compile 'com.android.support:design:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
user3693265
  • 109
  • 1
  • 9

2 Answers2

5

You need to using the support library version which is >= 24.1.0 because TextInputEditText is added in version 24.1.0. Read more at TextInputEditText

So, you can use the following:

compile 'com.android.support:design:25.3.1'
ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
Vinesh Chauhan
  • 1,288
  • 11
  • 27
1

Make sure you have added support design dependency first in build.gradle

Copy this TextInputLayout in your xml

 <android.support.design.widget.TextInputLayout
                android:id="@+id/userPhoneNumber"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="20dp"
                android:clipToPadding="false"
                android:gravity="bottom"
                android:paddingTop="4dp"
                android:textColorHint="@color/whiteTextColor"
                >
                <EditText
                    android:layout_width="match_parent"
                    android:layout_height="50dp"
                    android:layout_gravity="bottom"
                    android:background="@color/silveryBackground"
                    android:hint="@string/enterMobileNumber"
                    android:inputType="number"
                    android:maxLength="10"
                    android:paddingLeft="17dp"
                    android:paddingRight="17dp"
                    android:paddingTop="10dp"
                    android:singleLine="true"
                    android:textColor="@color/textColor"
                    android:textColorHint="@color/whiteTextColor"/>
            </android.support.design.widget.TextInputLayout>
Mohammed Farhan
  • 1,120
  • 8
  • 14