在Android开发中,我们可以自定义界面主题,通过控制属性的值,来改变界面的颜色,colorPrimary、colorPrimaryDark、colorAccent也是控制窗口颜色的属性,如下面这张图:
下面给出代码示例
1、在style.xml文件中,自定义主题MyAppTheme
<resources>
<!-- MyAppTheme. -->
<style name="MyAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
2、在AndroidManifest,xml使用该主题,给出文件的部分截图