Android TextInputField Inflator Error

后端 未结 13 1318
野的像风
野的像风 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:33

    I got the same issue when inflating XML containing TextInputLayout. The problem was fixed by setting the correct Style on my application. Just like it says here : android design support library

    I've the following issue

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

    My style.xml was

    
    
        
    
    

    As it said in this post on Design Support Library

    Note that as the Design library depends on the Support v4 and AppCompat Support Libraries, those will be included automatically when you add the Design library dependency.

    So NO NEED TO ADD the following line inside the gradle file

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

    I found the link behove explaining that the Design Support Library is part of the AppCompat and it require the AppCompat Theme base to work. So I've modify my style.xml to be

    
    
        
    
    

    And it worked.

提交回复
热议问题