ShadowMare
ShadowMare

Reputation: 2097

android ListView touch-animation gone when onClickListener is attached

I have a ListView with a custom layout for the child items.

Without the OnClickListener attached to the items each item highlights nicely when the user touches it but as soon as I attach the listener the animation is gone. The listener is working but then there is no animation or visual feedback. The same problem occurs when I use an OnTouchListener.

What can I do to grab the onClick-Event but still have the default animation?

Upvotes: 5

Views: 1418

Answers (1)

Zielony
Zielony

Reputation: 16537

With ListView you should use OnItemClickListener. If there's is a specific reason for using OnClickListener, you can manually fire the item click event. In your OnClickListener call performItemClick.

Upvotes: 4

Related Questions