当我试图给com.google.android.material.chip.Chip
class充气时,我的应用程序崩溃了。
我使用的依赖是implementation 'com.google.android.material:material:1.0.0'
这是我的XML代码
<com.google.android.material.chip.Chip
android:id="@+id/chipActive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipCornerRadius="5dp"
android:backgroundTint="@color/primaryColor"
android:textColor="@color/primaryTextColor"
android:textAlignment="center"
android:fontFamily="@font/roboto_regular"
android:layout_marginStart="10dp"
android:text="Active"/>
我得到的错误是
android.view.InflateException: Binary XML file line #18: Binary XML file line #18: Error inflating class com.google.android.material.chip.Chip
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
我在另一个帖子上发现了一个与我类似的问题,但那里没有对我有帮助的解决方案。如果有人对如何解决这个问题有任何建议,请帮助我:D
在发布此问题后我找到了解决方案。我更新了对implementation 'com.google.android.material:material:1.1.0-alpha02'
的依赖,现在它工作正常。
使用主题<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">