Android: Get MotionEvent within onListItemClick
I have a ListActivity and I want react to onListItemClick(ListView l, View v, int position, long id) .
But I als开发者_JAVA百科o want to know whether the user clicked on the left or the right side of the screen. Is there any changes I can get the MotionEvent from within the onListItemclicked-method.
I have a ListView. In every line there is a Name on the left and a average-vote on the right. When the user clicks in a row on the left I want to load an Activity that shows information about the name. When the user clicks on the right side of a row I want to load an Activity that lets the user vote on the name. I would like to use onListItemClick(ListView l, View v, int position, long id) for getting the row I'm in as it is so easy. But how can I know whether the user clicked on the left or the right.
Can I ask some object for the currently processed MotionEvent?
Thanks!
What about setting an OnClickListener
for both the left view and the right view? If necessary, you could pad the views so that they cover more of the row than they currently do. Then you would still receive the onListItemClick
when the click occurs in a "neutral" area.
精彩评论