gpt4 book ai didi

android.support.design.chip.芯片

转载 作者:搜寻专家 更新时间:2023-11-01 08:20:00 25 4
gpt4 key购买 nike

我在 android 上遇到芯片组件问题。我尝试实现这样的芯片:

    <android.support.design.chip.Chip
android:id="@+id/tags"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello world"/>

但是当我启动我的应用程序时出现此错误:

android.view.InflateException: Binary XML file line #59: Binary XML file line #59: Error inflating class android.support.design.chip.Chip

Caused by: android.view.InflateException: Binary XML file line #59: Error inflating class android.support.design.chip.Chip

Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).

我的风格已经是 AppCompact。

最佳答案

如果你想使用 android.support.design.chip,你需要使用 Theme.MaterialComponents.Light.Bridge 的应用主题,尽管 AppCompat。芯片.

Reason:

Chip component relies on new MaterialComponents theme, so is why the crash occurs. Bridge theme here are treated as AppCompat but provides new MaterialComponents theme when needed.

关于android.support.design.chip.芯片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52591845/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com