安卓preference类别的背景颜色 [英] android preference category background color

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

问题描述

我尝试定制preference类别的背景颜色。我已经改变了preferences本身的背景,但我不能找到一种方法如何改变类别的背景颜色。

我发现了两个方法,但他们没有为我工作: <一href="http://stackoverflow.com/questions/7048089/changing-the-$p$pference-category-label-color-background">changing在preference类别标签的颜色背景

通过此链接,我发现的这个,但对我来说没有什么工作。这是我做了什么还没有:

 &LT;资源&GT;
    &LT;样式名称=setBackgroundTheme父=安卓主题&GT;
        &LT;项目名称=机器人:背景&GT; @色/ darkbluelogo&LT; /项目&GT;
    &LT; /风格&GT;
&LT; /资源&GT;
 

在我的onCreate设立了主题有:

  setTheme(R.style.setBackgroundTheme);
 

解决方案

自定义你的背景颜色布局文件,在preferenceCategory设置:

 &LT; preferenceCategory
    机器人:布局=@布局/ your_layout&GT;
 

I try to customize the background color of preference categories. I already changed the background of the 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 work for me: changing the preference category label color background

Through this link, i found this, but nothing work for me. These is what I've done yet:

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

In onCreate I set the theme with:

setTheme(R.style.setBackgroundTheme);

解决方案

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

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

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

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