I would like to capture long click events in a ListView, which was easily done using a OnItemLongClickListener. However, that lacks the fading animation of the selector transitioning to a long press that is seen when the long click is handled by onCreateContextMenu. How can I get that animation using OnItemLongClickListener
?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I was having the same problem and resolved it by removing the following property in the LinearLayout for my rows:
android:clickable="true"
Removing that property or setting the value to false both fixed the problem.
回答2:
Make sure the enclosing list item's view specifies:
android:background="?android:attr/selectableItemBackground"