Reputation: 83
I am trying to implement the chip layout in android, I have updated my google material dependency to its latest version as well. But the XML file is throwing this problem
Failed to find '@attr/shapeAppearanceSmallComponent' in current theme.
gradle file
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>
Upvotes: 7
Views: 7095
Reputation: 141
Had the same issue and this fixed it for me in the themes.xml file
<style name="Theme.AITutorApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar.Bridge">
Upvotes: 0
Reputation: 21
Add for your theme:
<item name="textAppearanceTitleLarge">@style/TextAppearance.Material3.TitleLarge</item>
<item name="textAppearanceTitleMedium">@style/TextAppearance.Material3.TitleMedium</item>
<item name="textAppearanceTitleSmall">@style/TextAppearance.Material3.TitleSmall</item>
Upvotes: 1
Reputation: 654
go to themes.xml and replace MaterialComponents with Material3 in the parent="" tag for exemple
check your theme is it is like that
<style name="Theme.baseapp" parent="Theme.MaterialComponents.Light.NoActionBar">
change it to be like that
<style name="Theme.baseapp" parent="Theme.Material3.Light.NoActionBar">
Upvotes: 12
Reputation: 363737
The shapeAppearanceSmallComponent
attribute is defined in your theme.
To use the material components library you have to set a Theme.MaterialComponents
theme.
For example:
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Customize your theme here. -->
</style>
If you cannot change your theme to inherit from a Material Components theme you can also use a Theme.MaterialComponents.Bridge
theme
Upvotes: 4
Reputation: 34017
you can try to change your Base application theme to the following:
<style name="Theme.AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
Upvotes: 2