android.support.design.widget.TextInputLayout gives InflateException

三世轮回 提交于 2019-12-07 03:53:25
Alexiscanny

Without change anything in my gradle I simple fixed my issue by adding:

app:hintTextAppearance="@android:style/TextAppearance.Medium"

I hope this can help someone

HBB20

You should try few things to fix the problem.

  • extend your activity from AppCompatActivity
  • extend your fragment from android.support.v4.app.Fragment (you will need to add support library in build.gradle file, if not added).
  • You should use 22.2.1 or later version of design library (at the time of posting, latest version is 'com.android.support:design:23.0.0') for correct 'hint' behaviour on the lollipop and above devices. If you will use lower version than 22.2.1 , you will face issue discussed on stackOverflow. (In your case you are already using 22.2.1).
  • Instead of using EditText, use android.support.v7.widget.AppCompatEditText.

    • For example:

      <android.support.design.widget.TextInputLayout
                      android:id="@+id/tl_firstName"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      app:errorEnabled="true">
      
                      <android.support.v7.widget.AppCompatEditText
                          android:id="@+id/editText_firstName"
                          style="@style/editProfile_editText"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:hint="First Name"
                          android:inputType="textPersonName"
                          android:singleLine="true" />
      
      </android.support.design.widget.TextInputLayout>
      
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!