Problem with orange highlight in ListView

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

Problem with orange highlight in ListView

Postby Sowmya » Wed Apr 22, 2009 11:42 am

Hi,
I have a problem with orange highlight in the list view.I have 3 elements in the list view.When I scroll through the list,the elements are highlighted in orange.When one of the item is clicked,the corresponding screen view of that click event gets displayed.When Back button is pressed from that screen view, the listview gets displayed again,but the orange highlight got disappeared.It appears again after I touch the screen once and move the trackball.All this view switching is done within a single Activity.
How to make that orange highlight appear without tapping the screen?
Can anyone help me on this?
Sowmya
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Fri Mar 06, 2009 7:49 am

Top

Touch mode

Postby satishkumar_lskin » Fri Apr 24, 2009 2:49 pm

Hi,
When you click a child view in a ListView , the device enters into touch mode. The behavior u see is the default in touch mode.To make the views focusable in touch mode, you should use setFocusableInTouchMode(true) for each child view. On navigating back to the ListView from a new view , use requestFocus() on a partcular child view to make it focusable.
But making this change will give focus to the child view and will not trigger onClickListener , when u click on a child view that is not focused. So for a non-focused child view , two clicks are necessary to trigger a click event - first one to make it focusable and the second one for the click event. This is the change u face if u use setFocusableInTouchMode(true).
satishkumar_lskin
Developer
Developer
 
Posts: 32
Joined: Mon Oct 20, 2008 8:15 am
Location: Coimbatore , TamilNadu, India

Postby Sowmya » Mon Apr 27, 2009 10:44 am

Hi,
Thanks a lot.It worked.
Sowmya
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Fri Mar 06, 2009 7:49 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 2 guests