2014-05-10 4 views
0

Google지도가있는 MapView에서 Touch 이벤트를 훔치는 ScrollView와 관련된 여러 주제를 살펴 보았습니다. Google지도를 덮어 쓰는 방법에 대한 여러 가지 솔루션을 보았습니다. onTouch 이벤트. 내 응용 프로그램에 대한 ArcGIS지도를 사용하고 몇 가지 Google지도 솔루션을 시도하고 아무것도 일했다. 그래서 거기 밖으로 아무도지도 수직 및 수평으로 패닝 할 수 있도록 onTouch 이벤트를 재정의하려면 ScrollView있는 ArcGIS 맵뷰와 함께 작동하는 솔루션을 가지고 있는지 궁금하네요.ScrollView의 ArcGIS Mapview지도 스크롤 문제

현재 두 개의 레이어가 추가 된 MapView 만 있으므로 매우 기본적인 설정이지만 일부 코드를 게시하면 일부 코드를 게시하는 데 더 많은 도움이됩니다.

답변

1

작동하는 해결책을 제시하십시오.

나는 활동을 위해 onCreate에 리스너를 넣었다.

MyTouchListener tl = new MyTouchListener(this, mMapView); 
    mMapView.setOnTouchListener(tl); 

는 다음 나는 MapOnTouchListener 클래스를 확장 같은 활동 내에서 클래스를 만들었습니다.
class MyTouchListener extends MapOnTouchListener{ 

      ScrollView sv; 

    public MyTouchListener(Context c, MapView m){ 
     super(c, m); 
    } 

    public boolean onTouch(View v, MotionEvent event){ 
     sv = (ScrollView) findViewById(R.id.scroll); 
        int action = event.getAction(); 
     switch(action){ 
     case MotionEvent.ACTION_DOWN: 
      // will disable the scrollview from being able to 
          // intercept the touch events for the mapview 
          sv.requestDisallowInterceptTouchEvent(true); 
      break; 

     case MotionEvent.ACTION_UP: 
          // gives control back over to the scrollview 
      sv.requestDisallowInterceptTouchEvent(false); 
      break; 
     } 

     super.onTouch(v, event); 
     return true; 
    } 


} 

나는이 사람을 도와 그들에게 내가 찾던 찾기 위해 노력 소요되는 시간을 절약 할 수 있기를 바랍니다.

관련 문제