Help styling a view at runtime.
<p>I've jumped around looking for a proper solution to this problem, but can't find one. The answer might be that it's impossible, but I'm going to try one more time, even though many similar questions have been asked. </p>

<p>I have a view (it happens to be a RatingBar, but it could be a button or a TextView or even an ImageView) that I want a custom style for. Depending on <em>something</em>, I want it to (for example) use Red Stars, or Blue Stars, or Orange Stars. I want to use this view in a list, with a custom list adapter, so that based on some attribute in the underlying list data, the item list view shows either the Red-Star RatingBar, or the Blue-Star RatingBar, or the OrangeStar RatingBar. </p>

<p>I've attempted building a style from code (choosing the right drawables that reflect the color stars I want), and then having the custom ListAdapter create a new RatingBar with the appropriate style (since a view's style can't be changed after the view is created), but when I do that the RatingBar never shows up. I'm not sure if this is expected, or if I have something else wrong. </p>

<p>It's like I want a selector for my image selector, or maybe another (custom?) attribute for the selector I already have. </p>

<p>If I create a CustomView, that extends RatingBar, that has an extra attribute, would an xml-defined Selector be able to access that attribute and use it to select a different image? </p>

<p>I'd like to figure this out, because the only alternative I can come up with is to not use a ListView with a ListAdapter, which basically results in me writing more custom code. </p>

<p>Thoughts? </p>
