Prototik / HoloEverywhere

NO LONGER MAINTAINED. DEVELOP FOR 4.X+ DUDE.
MIT License
2.18k stars 608 forks source link

Styling of PreferenceActivity #828

Open 4nd3250n opened 10 years ago

4nd3250n commented 10 years ago

This is not an issue more of a question. I have looked at the styles in preferences addon but I was not able to come up with a solution. I have created my own theme with my colors and all the necessary drawables. If I set this theme to any of my activities it works ok. The exception is PreferenceActivity. The drawables for CheckBoxes are retained from holo theme not my custom drawables. What is the correct way to create a style for PreferenceActivity? A simple example perhaps?

Prototik commented 10 years ago

Did you read a wiki?

4nd3250n commented 10 years ago

Yes I did. My custom theme was:

<style name="ThemeCustom" parent="Holo.Theme.Light.DarkActionBar.Fullscreen">
…
    <item name="android:checkboxStyle">@style/Holo.CompoundButton.CheckBox.Custom</item>
    <item name="android:checkBoxPreferenceStyle">@style/Holo.CompoundButton.CheckBox.Custom</item>
…
</style>

These Holo.CompoundButton.CheckBox.Custom have different drawables. Everything else is the same. When I use this theme on my preference activity nothing is changed. The normal holo checkbox is used, not my custom drawables.

Upon closer look I added following line into my theme:

<item name="preferenceTheme">@style/ThemeCustom</item> <!-- application theme -->

This had the effect that the backround selectin color changed and that the CheckBoxed dissapearad completely. A liitle more insight how is the preference screen styled would be beneficial.

4nd3250n commented 10 years ago

Did anybody succeed in doing this?

bazted commented 10 years ago

@Prototik Can you tell where can we find "Holo.PreferenceTheme" from wiki? It seems out-dated. I've found "Holo.Internal.Preference"

<style name="Theme.Example.Preference" parent="Holo.Internal.Preference">
    <item name="checkBoxPreferenceStyle">@style/Holo.Example.PreferenceCheckBox</item>

</style>

<style name="Holo.Example.PreferenceCheckBox" parent="Holo.PreferenceCheckBox">
    <item name="android:button">@drawable/example_btn_check_holo_dark</item>
</style>

and called

    PreferenceInit.map(R.style.Theme_Example_Preference, R.style.Theme_Example_Preference);

in static block of mine Application class extended from org.holoeverywhere.app.Application.

And it doesn't work`s. One more question how can we change preference Item selector?