Android设置首选项类别的背景颜色 [英] Android set background color of preference category

查看:116
本文介绍了Android设置首选项类别的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试自定义首选项类别的背景颜色.我已经更改了首选项本身的背景色,但找不到改变类别背景色的方法.

I try to customize the background color of preference categories. I already changed the background color of a preferences itself but I can't find a way how to change the the categories background color.

我发现了两种方法,但它们对我不起作用: ​​更改首选项类别标签的颜色背景

I found two ways but they don't works for me: changing the preference category label color background

通过此链接,我找到了

Through this link, i found this, but nothing I've tried worked for me. These layout snippet is what I've tried so far:

<resources>
    <style name="setBackgroundTheme" parent="android:Theme">
        <item name="android:background">@color/darkbluelogo</item>
    </style>
</resources>

onCreate方法中,我将主题设置为:

In onCreate method I set the theme with:

setTheme(R.style.setBackgroundTheme);

推荐答案

使用背景色自定义布局文件,然后在您的PreferenceCategory中进行设置:

Custom a layout file with your background color, set it in your PreferenceCategory:

<PreferenceCategory
    android:layout="@layout/your_layout">

这篇关于Android设置首选项类别的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆