user3693265
user3693265

Reputation: 109

Error inflating class TextInputEditText

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'

Upvotes: 4

Views: 6782

Answers (2)

Vinesh Chauhan
Vinesh Chauhan

Reputation: 1378

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'

Upvotes: 5

Mohammed Farhan
Mohammed Farhan

Reputation: 1138

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>

Upvotes: 1

Related Questions