Domanda

I am implementing listview in android.I want listview row's layout_width and height to be increased when listview item is pressed.I am using zoom_in animation to scale view which i have kept in anim folder.But i couldnot use it in selector since i dont know how to start animation if i keep it in selector. I tried an other way that i implement animation in getView of adapter.Here i need to get the selected view's position that i set it from onTouchListener function.But now i cannot get the selected row's position in onTouch function.I want to know how to get the row's position in onTouch function? Or how to get the pressed state in getView function in adapter?Thanks in Advance.

È stato utile?

Soluzione

In your touch event you can get the X,Y coordinates of the touch.
The ListView has method pointToPosition

int pos = YOUR_LISTVIEW.pointToPosition((int) e1.getX(), (int) e1.getY());
  • e1 is MotionEvent
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top