Search code examples
androidtextviewpreferencesbackground-color

How can I make style changes in the preferences visible in my activity


I want to make it possible, that the user of my app can change the style of my app. So he should be able to decide, whether a background picture is shown, the textSize/textColor of different textViews, the background color of the activity.

How is that possible?! I know how to set up a style or a theme, but i don't know how to change the it by the users decision..

Can you help me please?!

Thanks a lot :)


Solution

  • You can change an Activity style at runtime, but only to existing styles. So you could have, say, 3 styles defines in different XML files, list those 3 to your user, have them select one, and set the style using Activity.setTheme(). You would then have to destroy the view and recreate it. Android doesn't currently support any other methods of changing the style at runtime.