Super setAdapter new RateableWrapper getContext
We simply subclass and override so we can wrap the supplied in our own .
Visually, the results are similar to the , albeit without top‑rated words appearing in all caps (see Figure 9‑5).
Figure 9‑5. The RateListViewDemo sample application
The difference is in reusability. We could package in its own JAR and plop it into any Android project where we need it. So while is somewhat complicated to write, we have to write it only once, and the rest of the application code is blissfully simple.
Of course, this could use some more features, such as programmatically changing states (updating both the and the actual itself), allowing other application logic to be invoked when a state is toggled (via some sort of callback), etc.
Дата добавления: 2015-05-16; просмотров: 813;