Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

Styling of PreferenceActivity #828

Open
4nd3250n opened this issue May 4, 2014 · 4 comments
Open

Styling of PreferenceActivity #828

4nd3250n opened this issue May 4, 2014 · 4 comments

Comments

@4nd3250n
Copy link

4nd3250n commented May 4, 2014

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
Copy link
Owner

Prototik commented May 5, 2014

Did you read a wiki?

@4nd3250n
Copy link
Author

4nd3250n commented May 6, 2014

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
Copy link
Author

4nd3250n commented May 7, 2014

Did anybody succeed in doing this?

@bazted
Copy link
Contributor

bazted commented May 8, 2014

@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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants