Reputation: 515
Good afternoon, I'm trying to solve a problem but I can not. I have two smartphones, a Nexus 5(Android 6.0) and one ZenFone 2(Android 5.0). The error only persisted only in ZenFone.
XML:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/TextLabel">
<EditText
android:id="@+id/et_login_pass"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/LoginPlaceholderPassword"
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
android.view.InflateException: Binary XML file line #25: Error inflating class EditText at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
What do I do?
Upvotes: 0
Views: 2402
Reputation: 109
I had the same issue here with ZenFone 2(Android 5.0).
Update your Android Support to:
compile 'com.android.support:design:25.3.0'
Remove:
android:theme="@style/TextLabel"
PS: Please replace fill_parent to match_parent =)
Upvotes: 1
Reputation: 187
Just create a sub class that extends EditText. For Example:
public class Text extends EditText {
public Text(Context context, AttributeSet attrs) {
super(context, attrs);
}
}
Then use this class in xml file instaed of EditText
<com.example.edittextproblem.Text
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="haha"/>
and your problem will be solved :)
Upvotes: 0
Reputation: 2428
Can you change your layout_width
to match_parent
and check if your definitely compiling the two dependencies you need in your build.gradle file please.
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
Upvotes: 1