【笔记】MaterialCardView遇坑
使用MaterialCardView遇坑
现象及问题原因:默认的项目AppCompat主题,不支持MaterialCardview风格,直接使用出现闪退(适配器加载页面失败).
解决办法:
- 第一步,styles.xml里面设定一个style
<style name="MaterialCardViewTheme" parent="Theme.MaterialComponents.NoActionBar"/>
- 第二步,MaterialCardView属性中添加style
android:theme="@style/MaterialCardViewTheme"