我有一个我正在使用 onTouch 的按钮,以便我可以移动它。但是该按钮现在无法加载 onClick 中的内容。如何让它发生?
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
//some code which dosent work
}
@Override public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
initialX = params.x;
initialY = params.y;
initialTouchX = event.getRawX();
initialTouchY = event.getRawY();
return true;
case MotionEvent.ACTION_UP:
Voice v1 = new Voice();
v1.putVoice();
return true;
case MotionEvent.ACTION_MOVE:
params.x = initialX + (int) (event.getRawX() - initialTouchX);
params.y = initialY + (int) (event.getRawY() - initialTouchY);
windowManager.updateViewLayout(chatHead, params);
return true;
}
return false;
}