无法在当前主题中找到“@attr/shapeAppearanceSmallComponent”

uts*_*hal 7 xml android render material-design material-components-android

我正在尝试在 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>
Run Code Online (Sandbox Code Playgroud)

XML文件

<?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>
Run Code Online (Sandbox Code Playgroud)

dev*_*vio 12

例如,转到 theme.xml 并将 Parent="" 标记中的 MaterialComponents 替换为 Material3

检查你的主题是不是这样

<style name="Theme.baseapp" parent="Theme.MaterialComponents.Light.NoActionBar">
Run Code Online (Sandbox Code Playgroud)

把它改成这样

<style name="Theme.baseapp" parent="Theme.Material3.Light.NoActionBar">
Run Code Online (Sandbox Code Playgroud)


zha*_*hen 2

您可以尝试将您的基本应用程序主题更改为以下内容:

<style name="Theme.AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
Run Code Online (Sandbox Code Playgroud)