farm ostrich
farm ostrich

Reputation: 5959

Android -- First ListView item is sometimes selected when ListView is initially displayed

When I press Menu and the ListView is presented, the top item is usually highlighted when the Activity is first started. I can click and make it not highlighted. What might be causing this? Actually I don't care about that, I just need a hack to stop it. I would post a code snippet but the ListActivity and its xml exceed 600 lines and I have no idea where the problem lies. Any ideas?

Upvotes: 0

Views: 373

Answers (1)

WarrenFaith
WarrenFaith

Reputation: 57672

The answer can be pretty easy: The first entry of every ListView is highlighted, when you are in the "non touch mode". That means when you navigate with the trackball.

Test it: Go the the home screen. Press the menu button and select "settings" with the trackball. The list displaying the settings main menu is now highlighted in the first row.

Doing the same without the trackball but with a touch on the menu entry "settings" the new list should be not highlighted.

Upvotes: 6

Related Questions