Android开发中,我们可以通过控制属性的值,改变界面的颜色来自定义界面主题
colorPrimary—导航栏颜色
colorPrimaryDark—通知栏颜色
colorAccent—控件选中后颜色
下面给出代码示例
1、在style.xml文件中,自定义主题AppTheme.White
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- AppTheme.White -->
<style name="AppTheme.White" parent="@style/AppTheme">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
2、在AndroidManifest,xml使用该主题,给出文件的部分截图
<application
android:name=".MyCarApplication"
android:allowBackup="false"
android:debuggable="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme.White">
————————————————
版权声明:本文为CSDN博主「小鱼儿211」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/l707941510/article/details/93772581