我想动态添加多个ViewFlipper但问题是在手势列表器上,只检测到最后添加的一个,
for (int i = 0; i < _Array.size(); i++) {
mViewFlipper = new ViewFlipper(mContext);
for (int j = 0; j < getContent().size(); j++) {
ImageView img = new ImageView(mContext);
if (j / 2 == 0)
img.setImageResource(R.drawable.img1);
else
img.setImageResource(R.drawable.img2);
mViewFlipper.addView(img);
}
mViewFlipper.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(final View view, final MotionEvent event) {
detector.onTouchEvent(event);
return true;
}
});
frame.addView(mViewFlipper);
}
detector是SimpleOnGestureListener。
我尝试只刷最后一个viewFlipper