Android View上の onTouchEvent
■インポート
import android.view.MotionEvent;
■タッチイベント
@Override
public boolean performClick()
{
super.performClick();
return true;
}
@Override
public boolean onTouchEvent(MotionEvent event)
{
super.onTouchEvent(event);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
test_flag = 1 - test_flag;
invalidate();
break;
case MotionEvent.ACTION_UP:
performClick();
break;
default:
break;
}
return true;
}