Android的改变背景颜色为preference片段 [英] Android changing the background color for preference fragment

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

问题描述

我设置了​​主题为我的应用程序,其中包括一个蓝色的背景...

I have set a theme for my application, which includes a blue background...

不过,这也让我的preference片段蓝也......我想保持原来的机器人:Theme.Holo.Light.DarkActionBar......

However, this also made my preference fragment blue also... I want to keep the original "android:Theme.Holo.Light.DarkActionBar"...

怎么办呢?谢谢!

推荐答案

添加以下code到你的preferenceFragment实现:

Add the following code to your PreferenceFragment implementation:

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    view.setBackgroundColor(getResources().getColor(android.R.color.your_color));

    return view;
}

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

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