안드로이드 개발 질문/답변
(글 수 45,052)
안녕하세요 뷰에 네모상자를 그리고 싶습니다. 그리고 그 네모상자의 크기를 변경할고 싶은데 터치 이벤트에서 드레그시에 action_move가 안들어 옵니다.
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
Log.e("move move","1 : "+touch_x+" 2 : "+moving_x);
if(event.getAction()==MotionEvent.ACTION_DOWN){
touch_x=(int)event.getX();
Log.e("move move","1 : "+touch_x+" 2 : "+moving_x);
}
if(event.getAction()==MotionEvent.ACTION_MOVE){
moving_x = (int)event.getX();
Log.e("move move","1 : "+touch_x+" 2 : "+moving_x);
invalidate();
}
return false;
}
public void run() {
invalidate();
}
이벤트가 제대로 들어오는지 확인 하기 위해 다음과 같이 테스트를 해보았는데. 드레그 시에는 터치 이벤트로 전혀 들어오지 않습니다.