I tested the following solution on SDK levels 8 and 16.
In getView()
setFocusable(false); setClickable(false);
instead of setting them true in the getView() adapter, it does what it seems to me to require an initial request, and means that the OnItemClickListener call OnItemClickListener called, provided that OnClickListener not set to getView() .
I assume that everything you can do in View OnClickListener can be done just as easily in ListView OnItemClickListener . ( setOnClickListener in the view implicitly sets the possibility of clickability, which prevents the ListView OnItemClickListener from being called, apparently.)
The behavior is the same as you would expect, in the form of a visual ImageButton state when you click or drag an item.
The solution is a little illusion, since the list item is not pressed by ImageButton itself, so if the button does not occupy the entire list item, clicking in another place on the item will still make the button popped state reflects the click. The same goes for focus. It may be worth the price.
JulianSymes Sep 19 '12 at 23:02 2012-09-19 23:02
source share