Dynamic themes and custom styles

Posted by Lawrence Kesteloot on Stack Overflow See other posts from Stack Overflow or by Lawrence Kesteloot
Published on 2012-10-29T04:58:29Z Indexed on 2012/10/29 4:59 UTC
Read the original article Hit count: 124

Filed under:

I've got an app with two themes (dark and light) that can be selected at runtime. This works. I also have a ListView with rows that can have one of three different layouts, each of which has a style (say, different colors). This also works. But I can't get these two features to work together. I really need six different styles, three for one theme (dark) and three for the other (light), but I can't figure out how to choose a style for a list item based on the current theme, or get that effect any other way by using XML files. My three layouts each point to a custom theme that sets the color, but that overrides whatever theme I've got set. Themes can only contain items that are "styleable", so I can't put my own custom items in there. There may be a way to do this programmatically, but I was hoping to do it declaratively. Any ideas?

© Stack Overflow or respective owner

Related posts about android