Reputation: 95
I'm face to a problem with chip component on android. I try to implemente a chip like this:
<android.support.design.chip.Chip
android:id="@+id/tags"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello world"/>
But when I launch my app I have this error:
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).
My style is already an AppCompact.
Upvotes: 2
Views: 1071
Reputation: 12118
You need to use app theme to Theme.MaterialComponents.Light.Bridge
inspite of AppCompat
if you want to use android.support.design.chip.Chip
.
Reason:
Chip
component relies on newMaterialComponents
theme, so is why the crash occurs.Bridge
theme here are treated asAppCompat
but provides newMaterialComponents
theme when needed.
Upvotes: 4