views:

86

answers:

1

I really like the look and feel of the Preference UI items and want to replicate that in my application. Basically I've got an Activity with a couple LinearLayouts set to be focusable. When they are focused, I want them to turn green (like Preferences do). Any idea how to apply that style to my LinearLayouts?

Note: The LinearLayouts are essentially going to be clickable 'buttons' to launch a separate activity. They are NOT actual preferences or buttons, although they need to look/act similar to them.)

A: 

The preference UI system is made from a ListView, not a LinearLayout. Each preference is a row in the list. That will be much simpler to implement than will doing this via nested focusable LinearLayouts.

If it helps, you can use my SackOfViewsAdapter as an idea how to build a ListAdapter that can return a set of rows that all look different.

CommonsWare
Elsewhere in my app, I was able to use a ListAdapter for custom UI elements in each list item. I was hoping to avoid this since I only need to style two item, each displaying info from different objects - ListViews seemed like overkill / not the right solution. But since the appearance is important, I'll give it a go. Thanks!
Colin O'Dell