如何更改PreferenceFragment周围的背景颜色框?

时间:2015-06-22 08:11:33

标签: android android-layout android-fragments android-preferences

我将PreferenceActivity与标题(右侧)和PreferenceFragment(左侧)一起使用。我在片段(按钮和文本)中更改布局,但不能更改灰框。

屏幕截图:http://i.stack.imgur.com/mdcFS.png

public class PrefActivity extends PreferenceActivity {

@Override
public void onBuildHeaders(List<Header> target) {
    super.onBuildHeaders(target);
    loadHeadersFromResource(R.xml.pref_headers, target);
}

}

public class PrefFragmentMain extends PreferenceFragment {

@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_main); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = super.onCreateView(inflater, container, savedInstanceState); v.setBackgroundColor(getResources().getColor(R.color.color_dark_yellow)); return v; }

}

0 个答案:

没有答案