改变preference背景颜色 [英] change background color of Preference

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

问题描述

我有一个 preferenceCategory ,XML文件,我已经定义了所有preferences在里面,我把这种从一个扩展 preferenceActivity 。我无法设置我的设置屏幕的背景下,这种屏幕会显示XML文件的帮助,如下图所示。请看到我已经定义了安卓背景=#041A37,还在屏幕保持默认颜色:黑色

I have a PreferenceCategory, xml file and I have defined all preferences in it, I call this from class that extends PreferenceActivity. I am unable to set the background of my settings screen, this screen is displayed with help of xml file shown below. Please see that I have already defined the android:background="#041A37", still the screen remains default color: black.

public class MyPreferenceActivity extends PreferenceActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        Context mContext=super.getBaseContext();
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.layout.preference);
        //v.setBackgroundColor(Color.rgb(4, 26, 55));
    }
}


preference.xml是


preference.xml is

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="#041A37" >

    <PreferenceCategory>
        <com.dropcall.SeekBarPreference
            android:background="#041A37"
            android:defaultValue="5"
            android:key="@string/Interference_Delay"
            android:progressDrawable="@drawable/seekbardrawable"
            android:title="Seconds Delay until intereference" />

        <com.dropcall.SeekBarPreference2
            android:defaultValue="30"
            android:key="@string/Drop_Delay"
            android:progressDrawable="@drawable/seekbardrawable"
            android:title="Seconds delay until drop" />

        <CheckBoxPreference
            android:background="@drawable/state_normal"
            android:defaultValue="true"
            android:key="@string/Drop_Option"
            android:title="Close after call drop" />
        <CheckBoxPreference
            android:background="@drawable/state_normal"
            android:defaultValue="true"
            android:key="@string/Timer_Option"
            android:title="Start timers on launch" />
    </PreferenceCategory>

</PreferenceScreen>


虽然我已经设置安卓背景=#041A37中的每个文件,背景不会变成深蓝色或其他颜色的这个问题。它仍然是默认的颜色,黑色。如何改变的背景颜色。请让我知道任何指针/提示,如果你遇到了同样的问题,让我知道你做什么样的变化,以设置背景颜色。


Although I have set android:background="#041A37" in every file, the background doesn't turn into navy blue, or any other color for that matter. It remains default color, black. How to change the background color. Please let me know any pointers / hints , if you had faced same issue let me know what changes you made to set the background color.

推荐答案

这为我工作。

getListView().setBackgroundColor(Color.TRANSPARENT);

getListView().setCacheColorHint(Color.TRANSPARENT);

getListView().setBackgroundColor(Color.rgb(4, 26, 55));

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

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