11

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

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

How to do so? thanks!

4

2 回答 2

23

将以下代码添加到您的 PreferenceFragment 实现中:

@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;
}
于 2013-06-12T18:18:27.100 回答
0

您可以使用样式文件或在您的 PreferenceActivity 添加此

getListView().setBackgroundColor(Color.rgb(255, 0, 0)); // or whatever color value you want
于 2013-05-03T07:45:09.853 回答