Android材质芯片组件崩溃应用程序.无法膨胀xml [英] Android material chip component crashing app. Unable to inflate xml
本文介绍了Android材质芯片组件崩溃应用程序.无法膨胀xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试过芯片组件
com.google.android.support:design:28.0.0-rc01
和材料
com.google.android.material:material:1.0.0-rc01
Tried Chip component from both support library
com.google.android.support:design:28.0.0-rc01
and material
com.google.android.material:material:1.0.0-rc01
StackTrace
android.view.InflateException: Binary XML file line #72: Binary XML file
line #72: Error inflating class com.google.android.material.chip.Chip
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)`
布局
<com.google.android.material.chip.Chip
android:id="@+id/chip"
style="style/Widget.MaterialComponents.Chip.Entry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/account"
app:closeIconEnabled="true" />`
推荐答案
更新您的应用主题,以继承以下主题之一:
Update your app theme to inherit from one of these themes:
Theme.MaterialComponents
Theme.MaterialComponents.NoActionBar
Theme.MaterialComponents.Light
Theme.MaterialComponents.Light.NoActionBar
Theme.MaterialComponents.Light.DarkActionBar
例如:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
注意:使用材料组件"主题可以启用自定义视图充气器
Note: Using a Material Components theme enables a custom view inflater
来源: https://www.material.io/develop/android/docs/getting-开始/
这篇关于Android材质芯片组件崩溃应用程序.无法膨胀xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文