How to set a item(with highlight)selected in ListView?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

How to set a item(with highlight)selected in ListView?

Postby foolstudio » Mon Sep 28, 2009 2:28 pm

Dear all,

There have 3 items in a ListView, and I want set the second item to be selected.

I use getListView().setSelection(1) and getListView().setItemChecked(1,true) as well,

but no any effect, the item not appear orange highlight.

Somebody can help me? Thanks a lot!
User avatar
foolstudio
Freshman
Freshman
 
Posts: 2
Joined: Mon Sep 28, 2009 2:16 pm

Top

Postby Raghav_s » Tue Sep 29, 2009 10:25 am

u may use OnListItemClick().
Raghav_s
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Sep 23, 2009 11:25 am
Location: Chennai

Postby foolstudio » Wed Sep 30, 2009 2:12 am

Raghav_s wrote:u may use OnListItemClick().


I want set the selected status automatically, and not use manually via UI.
User avatar
foolstudio
Freshman
Freshman
 
Posts: 2
Joined: Mon Sep 28, 2009 2:16 pm

Postby blackgin » Wed Sep 30, 2009 9:03 am

Are you sure your list is checkable?
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests