开发者

Style for PrefenceScreen

开发者 https://www.devze.com 2023-01-13 19:49 出处:网络
I\'d like to be able开发者_如何学C to customize the view of a PreferenceScreen, and so I\'m interested in knowing how to set a style for it. I wouldn\'t recommend it but you can start extending all th

I'd like to be able开发者_如何学C to customize the view of a PreferenceScreen, and so I'm interested in knowing how to set a style for it.


I wouldn't recommend it but you can start extending all the preference's classes (DialogPreference, CheckboxPreference, etc) and create your own widgets with the style you want.


Try this for increasing font size in onResume():

Window window = getActivity().getWindow();
window.getContext().setTheme(R.style.PreferencesTheme);

and create a style PreferencesTheme in layout/styles.xml file:

<style name="PreferencesTheme">
<item name="android:textColor">#000000</item>

    <item name="android:windowNoTitle">true</item>
    <item name="android:textSize">40sp</item>
    <item name="android:paddingLeft">0sp</item>
    <item name="android:colorBackground">#0000ff</item>
</style>
0

精彩评论

暂无评论...
验证码 换一张
取 消