android 5.0以上colorAccent 就是控件的颜色
switch 颜色
<item name="android:colorAccent">@android:color/black</item>
<style name="QucikSettings.Base" parent="@android:style/Theme.Material.Settings">
<item name="android:colorPrimary">@android:color/black</item>
<item name="android:colorPrimaryDark">@android:color/black</item>
<item name="android:colorAccent">@android:color/black</item>
<item name="android:actionBarStyle">@style/QucikSettingsActionBarStyle</item>
<item name="android:homeAsUpIndicator">@drawable/ic_back_arrow_gold</item>
</style>
修改preferenceCategory title颜色
<item name="@*android:preferenceCategoryStyle">@style/PreferenceCategoryStyle</item>
<style name="PreferenceCategoryStyle" parent="@*android:style/Preference.Material.Category">
<item name="android:layout">@layout/preference_category_material</item>
</style>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 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.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+android:id/title"
android:layout_width="match_parent"
android:layout_height="@dimen/dashboard_category_title_height"
android:paddingStart="@dimen/dashboard_category_title_margin_start"
android:singleLine="true"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:textAppearance="@style/TextAppearance.CategoryTitle.unbold"
android:textColor="@color/category_title_text"
android:textAlignment="viewStart"
android:background="@color/category_title_background" />
<color name="category_title_text">#818181</color>
switch 颜色
<item name="android:colorAccent">@android:color/black</item>
<style name="QucikSettings.Base" parent="@android:style/Theme.Material.Settings">
<item name="android:colorPrimary">@android:color/black</item>
<item name="android:colorPrimaryDark">@android:color/black</item>
<item name="android:colorAccent">@android:color/black</item>
<item name="android:actionBarStyle">@style/QucikSettingsActionBarStyle</item>
<item name="android:homeAsUpIndicator">@drawable/ic_back_arrow_gold</item>
</style>
修改preferenceCategory title颜色
<item name="@*android:preferenceCategoryStyle">@style/PreferenceCategoryStyle</item>
<style name="PreferenceCategoryStyle" parent="@*android:style/Preference.Material.Category">
<item name="android:layout">@layout/preference_category_material</item>
</style>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 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.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+android:id/title"
android:layout_width="match_parent"
android:layout_height="@dimen/dashboard_category_title_height"
android:paddingStart="@dimen/dashboard_category_title_margin_start"
android:singleLine="true"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:textAppearance="@style/TextAppearance.CategoryTitle.unbold"
android:textColor="@color/category_title_text"
android:textAlignment="viewStart"
android:background="@color/category_title_background" />
<color name="category_title_text">#818181</color>
本文介绍如何在Android 5.0及以上版本中配置应用的主题颜色,包括primary、accent等颜色属性,并展示了如何自定义偏好设置类别标题的颜色。

730

被折叠的 条评论
为什么被折叠?



