首页 > 解决方案 > 为什么 android:colorBackground 在某些设备上不起作用?

问题描述

<resources>
    <style name="Theme.MyApplication" parent="Theme.MaterialComponents.Light">
        <item name="android:colorBackground">#26A69A</item>
    </style>
</resources>

我想知道为什么android:colorBackground在某些设备上不起作用。我在 API 21 (Not working)24 (Not Working)29 (Working).

标签: androidmaterial-designmaterial-components-androidmaterial-components

解决方案


在我这样更改后它现在可以工作了

<resources>
    <style name="Theme.MyApplication" parent="Theme.MaterialComponents.Light">
        <item name="android:colorBackground">@color/myColor</item>
    </style>
</resources>

推荐阅读