当前位置: 移动技术网 > 移动技术>移动开发>IOS > 出现The style on this component requires your app theme to be Theme.MaterialComponents错误

出现The style on this component requires your app theme to be Theme.MaterialComponents错误

2020年08月10日  | 移动技术网移动技术  | 我要评论

我碰到这样的问题是由于我是用MaterialCardView时出现的,可能使用使用其他的Material库的控件时,也会出现这样的错误提示。这个错误就是说当前组件的主题是需要 Theme.MaterialComponents这样的主题。那么如何修改呢???

只需要在style.xml文件中,修改一下主题就可以了。

 <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

只需要换前面的就可以了,后面具体想要什么样的还是和之前一样的。

如果大家还有更好的解决办法,可以在评论留言交流哦!!!

本文地址:https://blog.csdn.net/qq_41677326/article/details/107892730

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网