Android 之@style/AppTheme:colorPrimary、colorPrimaryDark、colorAccent

本文介绍了Android应用主题中的多种颜色属性,包括应用主要色调、暗色调、状态栏颜色、窗口背景色等,还提及了控件如CheckBox、RadioButton等在不同状态下的默认颜色,以及按钮、输入框、文字等的颜色属性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

    <!--状态栏颜色-->
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <!--控制各个控件被选中时的颜色-->
    <item name="colorAccent">@color/colorAccent</item>
    <!--页面背景色-->
    <item name="android:windowBackground">@color/windowBackg</item>
    <!--底部导航栏颜色-->
    <item name="android:navigationBarColor">@color/navigationColor</item>
    <!--Appbar背景色-->
    <item name="android:colorPrimary">@color/colorPrimary</item>
    <!--ToolBar上的Title颜色-->
    <item name="android:textColorPrimary">@color/textColorPrimary</item>
    <!--各个控制控件的默认颜色-->
    <item name="android:colorControlNormal">@color/colorControlNormal</item>

1.colorPrimary 应用的主要色调,actionBar默认使用该颜色,Toolbar导航栏的底色

2.colorPrimaryDark 应用的主要暗色调,statusBarColor默认使用该颜色

3.statusBarColor 状态栏颜色,默认使用colorPrimaryDark

4.windowBackground 窗口背景颜色

5.navigationBarColor 底部栏颜色

6.colorForeground 应用的前景色,ListView的分割线,switch滑动区默认使用该颜色

7.colorBackground 应用的背景色,popMenu的背景默认使用该颜色

8.colorAccent CheckBox,RadioButton,SwitchCompat等一般控件的选中效果默认采用该颜色

9.colorControlNormal CheckBox,RadioButton,SwitchCompat等默认状态的颜色。

10.colorControlHighlight 控件按压时的色调

11.colorControlActivated 控件选中时的颜色,默认使用colorAccent

12.colorButtonNormal 默认按钮的背景颜色

13.editTextColor:默认EditView输入框字体的颜色。

14.textColor Button,textView的文字颜色

15.textColorPrimaryDisableOnly RadioButton checkbox等控件的文字

16.textColorPrimary 应用的主要文字颜色,actionBar的标题文字默认使用该颜色

17.colorSwitchThumbNormal: switch thumbs 默认状态的颜色. (switch off) 

<?xml version="1.0" encoding="utf-8"?><!-- /* //device/apps/Preferences/assets/res/any/styles.xml ** ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ --> <resources> <style name="style_bottom_button_right"> <item name="android:layout_marginRight">8dip</item> <item name="android:layout_marginLeft">7dip</item> </style> <style name="background_style"> </style> <style name="FullscreenTheme" parent="@android:style/Theme.Material"> <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item> <item name="android:windowActionBarOverlay">true</item> <item name="android:windowBackground">@null</item> <item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item> <item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item> </style> <style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar"> <item name="android:background">@color/black_overlay</item> </style> <style name="Preference.Engineer" parent="@style/Preference.Material"> <item name="allowDividerAbove">true</item> <item name="allowDividerBelow">true</item> <item name="iconSpaceReserved">false</item> </style> <style name="CheckBoxPreference.Engineer" parent="Preference.CheckBoxPreference.Material"> <item name="allowDividerAbove">true</item> <item name="allowDividerBelow">true</item> <item name="iconSpaceReserved">false</item> </style> <style name="PreferenceScreen.Engineer" parent="Preference.PreferenceScreen.Material"> <item name="allowDividerAbove">true</item> <item name="allowDividerBelow">true</item> <item name="iconSpaceReserved">false</item> </style> <style name="PreferenceCategory.Engineer" parent="Preference.Category.Material"> <item name="allowDividerAbove">true</item> <item name="allowDividerBelow">false</item> <item name="iconSpaceReserved">false</item> </style> <style name="DialogPreference.Engineer" parent="Preference.DialogPreference.Material"> <item name="allowDividerAbove">true</item> <item name="allowDividerBelow">true</item> <item name="iconSpaceReserved">false</item> </style> <style name="Theme.AppCompat.Engineer" parent="Theme.AppCompat"> <item name="android:panelBackground">@color/material_grey_850</item> <item name="android:windowBackground">@color/material_grey_850</item> <item name="preferenceStyle">@style/Preference.Engineer</item> <item name="checkBoxPreferenceStyle">@style/CheckBoxPreference.Engineer</item> <item name="preferenceScreenStyle">@style/PreferenceScreen.Engineer</item> <item name="dialogPreferenceStyle">@style/DialogPreference.Engineer</item> <item name="preferenceCategoryStyle">@style/PreferenceCategory.Engineer</item> </style> <style name="Theme.FrameRateScreenTest" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> <item name="colorPrimary">@color/purple_500_</item> <item name="colorPrimaryVariant">@color/purple_700_</item> <item name="colorOnPrimary">@color/white_</item> <item name="colorSecondary">@color/teal_200_</item> <item name="colorSecondaryVariant">@color/teal_700_</item> <item name="colorOnSecondary">@color/black</item> <item name="android:statusBarColor">?attr/colorPrimaryVariant</item> </style> <style name="trans_bg_dialog" parent="Theme.AppCompat.Dialog"> <item name="android:windowFrame">@null</item> <item name="android:windowIsFloating">true</item> <item name="android:windowIsTranslucent">true</item> <item name="windowNoTitle">false</item> <item name="android:windowBackground">@drawable/transparents</item> <item name="android:backgroundDimEnabled">true</item> <item name="android:backgroundDimAmount">0.5</item> </style> <style name="Transparent" parent="@style/Theme.AppCompat"> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:colorBackgroundCacheHint">@null</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowAnimationStyle">@android:style/Animation</item> <item name="android:windowNoTitle">true</item> <item name="android:windowContentOverlay">@null</item> <item name="windowNoTitle">true</item> <item name="windowActionBar">false</item> </style> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorAccent">@color/material_grey_850</item> <item name="android:colorPrimaryDark">@color/material_grey_850</item> <item name="android:colorPrimary">@color/material_grey_850</item> <item name="android:colorAccent">@color/material_grey_850</item> <item name="android:background">@color/material_grey_850</item> <item name="windowNoTitle">true</item> </style> </resources>
最新发布
08-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值