티스토리 뷰

import android.content.Context;
import android.view.MotionEvent;

public class test extends Activity {
 @Override
 public boolean onTouchEvent(MotionEvent event) {
  int action = event.getAction();

  int xPos = -1;
  int yPos = -1;

  switch (action) {
  case (MotionEvent.ACTION_DOWN): // Touch screen pressed
   break;
  case (MotionEvent.ACTION_UP): // Touch screen touch ended
   break;
  case (MotionEvent.ACTION_MOVE): // Contact has moved across screen
   // Single touch event.
   xPos = (int) event.getX();
   yPos = (int) event.getY();
   break;
  case (MotionEvent.ACTION_CANCEL): // Touch event cancelled
   break;
  case (MotionEvent.ACTION_OUTSIDE): // Movement has occurred outside the
   // bounds of the screen element
   // being monitored
   break;
  }
  return super.onTouchEvent(event);
 }
}

반응형
댓글
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
최근에 올라온 글
글 보관함
Total
Today
Yesterday