开发者

Highlight selected item in ListView

I am using fragments to display a panel wit开发者_如何学运维h two choices, A and B. When the user clicks on a choice, I would like to highlight the individual choice.

In onActivityCreated:

setListAdapter(new ArrayAdapter(getActivity(), android.R.layout.simple_list_item_activated_1, settingsNames));

By using the .simple_list_item_activated_1, I get exactly what I want. But how to I override the 'blue' highlight color? It sounds simple enough, but I'm having a lot of trouble.

I've tried it in a roundabout way, but it doesn't select the first item, when the activity is first created. I've tried to make it a 'button' and set drawable when pressed, but didn't work. So, is there a simple way to override the default android styles?

Thank you so much.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜