Android TextInputField Inflator Error

后端 未结 13 1315
野的像风
野的像风 2020-12-03 06:55

Had a crash while trying to use the new TextInputField for Android and wanted to share my solution.

Trying the new TextInputField in the android appcomp

13条回答
  •  南方客
    南方客 (楼主)
    2020-12-03 07:44

    Make sure you have the following dependencies in your gradle file:

    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:design:22.2.0'
    

    Working example:

    
        
    
    

    (Setting hintTextAppearance is not necessary.)

    Update:

    If you experience issues with the hint text not appearing in newer versions of Android (Marshmallow / Nougat), update library to version 22.2.1 (see TextInputLayout not showing EditText hint before user focus on it).

    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:design:22.2.1'
    

提交回复
热议问题