我需要找出使用a显示的列表中一个元素的像素位置ListView.看起来我应该得到一个TextView然后使用getTop(),但我无法弄清楚如何获得一个子视图ListView.
更新:对于a,子ViewGroup项与列表中的项目不一一对应ListView.相反,他们ViewGroup的孩子只对应那些现在可见的视图.因此getChildAt(),对内部的索引进行操作,ViewGroup并且不一定与ListView使用的列表中的位置有任何关系.
我有一个显示一些图像的gridview.我已经实现了一个ViewFlipper来导航gridviews页面,我的问题是我现在不能使用onItemClickListener.
我正在尝试使用onSingleTapConfirmed.
这是MyGestureDetector类:
class MyGestureDetector extends SimpleOnGestureListener {
private static final int SWIPE_MIN_DISTANCE = 120;
private static final int SWIPE_MAX_OFF_PATH = 250;
private static final int SWIPE_THRESHOLD_VELOCITY = 200;
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
System.out.println(" in onFling() :: ");
if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
return false;
if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE
&& Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
vf.setInAnimation(inFromRightAnimation());
vf.setOutAnimation(outToLeftAnimation());
vf.showNext();
} else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE
&& Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { …Run Code Online (Sandbox Code Playgroud)