@Override
public boolean onTouchEvent(MotionEvent ev) {
// TODO Auto-generated method stub
// only after long click this event can triger
//big bug in it , do it later
Log.v("movejudge", "enter onTouchEvent " + "ev.action "
+ ev.getAction() + " longPress: "
+ HorizontialListView.this.mLongClick + " actionMove:"
+ actionMove + " MoveSucess " + moveSucess);
if (HorizontialListView.this.mLongClick == true)
{
int action = ev.getAction();
//move event ,after long click
if (action == MotionEvent.ACTION_MOVE && moveSucess == false)
{
// do something;
// Log.v("movejudge ","after"+ moveSucess+"");
moveSucess = myOnGestureListener.onMove(ev);
actionMove = true;
Log.v("movejudge "," in MoveEvent: moveSucess "+moveSucess+" actionMove "+ actionMove);
}
// action up :after actionMove and Move not sucess
else if (action == MotionEvent.ACTION_UP && actionMove == true)
{ // if action up then the longclick =true
Log.v("movejudge", "enter action up");
HorizontialListView.this.mLongClick = false;
if (moveSucess == true)
{
moveSucess = false;
}
else
{
myOnGestureListener.onUp();
HorizontialListView.this.mLongClick = false;
actionMove = false;
moveSucess = false;
}
}
}
return super.onTouchEvent(ev);
}
自定义horizlist里面的元素被remove掉后难道关联到list的listener也被重构了?导致逻辑混乱,后来将内部类成员变量定义为外部内成员对象才解决问题。
android 自定义listener对象被自动析构和重建
最新推荐文章于 2022-04-15 07:55:12 发布