我正在尝试在 android 中实现芯片布局,我也将我的谷歌材料依赖项更新到了最新版本。但是 XML 文件引发了这个问题
Failed to find '@attr/shapeAppearanceSmallComponent' in current theme.
梯度文件
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://jitpack.io'
}
}
}
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimaryDark</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
XML File
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.chip.ChipGroup
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/chipGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.chip.Chip
android:id="@+id/chip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text" />
</com.google.android.material.chip.ChipGroup>
例如,转到 theme.xml 并将 Parent="" 标记中的 MaterialComponents 替换为 Material3
检查你的主题是不是这样
<style name="Theme.baseapp" parent="Theme.MaterialComponents.Light.NoActionBar">
把它改成这样
<style name="Theme.baseapp" parent="Theme.Material3.Light.NoActionBar">
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)