하고 싶은건 이미지 3개를 놓고 터치를 이동하면서 그 위를 지나 가면 이미지를 변경 하고 싶어서 이렇게 질문을 올립니다.

 

현재 MOVE 이벤트까지는 되는데.. 문제는 이미지 위를 지나 갔는데 알수가 없네요..

소스는 아래 처럼 구현 했습니다.

 

 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main_linear"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
 
     <ImageView android:id="@+id/one_imageview"
      android:layout_width="70dp"
     android:layout_height="70dp"/>
  <ImageView android:id="@+id/two_imageview"
      android:layout_width="70dp"
     android:layout_height="70dp"/>
  <ImageView android:id="@+id/three_imageview"
      android:layout_width="70dp"
     android:layout_height="70dp"/>
              
</LinearLayout> 

 

Activity  전체에 implements OnTouchListener 를 선언 하고

 

all_screen.setOnTouchListener(this);

one_ImageView.setOnTouchListener(this);

two_ImageView.setOnTouchListener(this);
three_ImageView.setOnTouchListener(this);

 

이벤트 걸구요...

    public boolean onTouch(View v, MotionEvent event) {
     if(event.getAction() == MotionEvent.ACTION_DOWN){
      switch(v.getId() ){
   case R.id.one_imageview:
    one_ImageView.setBackgroundResource(이미지 );
    break;
   case R.id.two_imageview:
    two_ImageView.setBackgroundResource(이미지);
    break; 
   case R.id.three_imageview:
    three_ImageView.setBackgroundResource(이미지);
    break;

}else if(event.getAction() == MotionEvent.ACTION_MOVE){

      switch(v.getId() ){
   case R.id.one_imageview:
    one_ImageView.setBackgroundResource(이미지 );
    break;
   case R.id.two_imageview:
    two_ImageView.setBackgroundResource(이미지);
    break; 
   case R.id.three_imageview:
    three_ImageView.setBackgroundResource(이미지);
    break;

}

}