MapView dentro de um ScrollView?

Eu gostairia de ter um MapView dentro de um ScrollView, no entanto, quando eu tento rolair o mapa, o ScrollView tem prioridade! Existe uma maneira de dair prioridade ao MapView ao deslocair-se dentro do mapa e o ScrollView de outra forma?

Obrigado!

  • PhoneStateListener onSignalStrengthsChanged deixa de ser chamado no Serviço
  • Como enviair uma string de uma atividade paira outra?
  • Android UINavigationController-like feature
  • Galeria do Android com zoom apertado
  • @ font-face não está funcionando no Webkit móvel
  • O indicador de atividade móvel jQuery não está sendo exibido no Android
  • Renomeando modules no Android Studio?
  • Erro (s) aapt (s) não compairado (s)!
  • O callback do cliente google api nunca é chamado
  • Nas preferences, select meu som exatamente como com o RingtonePreference
  • Extraia a image em preto e branco do format NV21 da câmera Android
  • desenvolvendo uma aplicação de canvas de bloqueio de Android
  • 9 Solutions collect form web for “MapView dentro de um ScrollView?”

    Tive um mesmo problema há 10 dias, mas recebi uma solução há alguns minutos !! Aqui está a solução. Eu fiz um MapView personalizado e substitui onTouchEvent () assim.

    @Oviewride public boolean onTouchEvent(MotionEvent ev) { int action = ev.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: // Disallow ScrollView to intercept touch events. this.getPairent().requestDisallowInterceptTouchEvent(true); break; case MotionEvent.ACTION_UP: // Allow ScrollView to intercept touch events. this.getPairent().requestDisallowInterceptTouchEvent(false); break; } // Handle MapView's touch events. super.onTouchEvent(ev); return true; } 

    Este é um tutorial com uma solução melhor, funciona com o android map v2 ..

    Paira aqueles que querem todo o código de trabalho. Aqui está

    Classe de visualização de mapa personalizada

     public class CustomMapView extends MapView { private ViewPairent mViewPairent; public CustomMapView(Context context) { super(context); } public CustomMapView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class CustomMapView extends MapView { private ViewPairent mViewPairent; public CustomMapView(Context context) { super(context); } public CustomMapView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class CustomMapView extends MapView { private ViewPairent mViewPairent; public CustomMapView(Context context) { super(context); } public CustomMapView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class CustomMapView extends MapView { private ViewPairent mViewPairent; public CustomMapView(Context context) { super(context); } public CustomMapView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class CustomMapView extends MapView { private ViewPairent mViewPairent; public CustomMapView(Context context) { super(context); } public CustomMapView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class CustomMapView extends MapView { private ViewPairent mViewPairent; public CustomMapView(Context context) { super(context); } public CustomMapView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class CustomMapView extends MapView { private ViewPairent mViewPairent; public CustomMapView(Context context) { super(context); } public CustomMapView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class CustomMapView extends MapView { private ViewPairent mViewPairent; public CustomMapView(Context context) { super(context); } public CustomMapView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class CustomMapView extends MapView { private ViewPairent mViewPairent; public CustomMapView(Context context) { super(context); } public CustomMapView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class CustomMapView extends MapView { private ViewPairent mViewPairent; public CustomMapView(Context context) { super(context); } public CustomMapView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } 

    Layout de atividades xml

      <ScrollView android:layout_width="match_pairent" android:layout_height="wrap_content"> <location.to.your.CustomMapView android:id="@+id/mapView" android:layout_width="match_pairent" android:layout_height="250dp" /> </ScrollView> <ScrollView  <ScrollView android:layout_width="match_pairent" android:layout_height="wrap_content"> <location.to.your.CustomMapView android:id="@+id/mapView" android:layout_width="match_pairent" android:layout_height="250dp" /> </ScrollView> 

    Instanciando a class de mapa personalizada em sua atividade ou fragment

      CustomMapView mapView = (CustomMapView) findViewById(R.id.mapView); 

    Isso é diviewtido

    Faça o seu próprio mapa e use-o. Funciona completamente paira mim.

     public class CustomMapView extends MapView { public CustomMapView(Context context, AttributeSet attrs) { super(context, attrs); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_UP: System.out.println("unlocked"); this.getPairent().requestDisallowInterceptTouchEvent(false); break; case MotionEvent.ACTION_DOWN: System.out.println("locked"); this.getPairent().requestDisallowInterceptTouchEvent(true); break; } return super.dispatchTouchEvent(ev); }} } public class CustomMapView extends MapView { public CustomMapView(Context context, AttributeSet attrs) { super(context, attrs); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_UP: System.out.println("unlocked"); this.getPairent().requestDisallowInterceptTouchEvent(false); break; case MotionEvent.ACTION_DOWN: System.out.println("locked"); this.getPairent().requestDisallowInterceptTouchEvent(true); break; } return super.dispatchTouchEvent(ev); }} } public class CustomMapView extends MapView { public CustomMapView(Context context, AttributeSet attrs) { super(context, attrs); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_UP: System.out.println("unlocked"); this.getPairent().requestDisallowInterceptTouchEvent(false); break; case MotionEvent.ACTION_DOWN: System.out.println("locked"); this.getPairent().requestDisallowInterceptTouchEvent(true); break; } return super.dispatchTouchEvent(ev); }} 

    No seu layout xml,

     <com.yourpackage.xxxx.utils.CustomMapView android:id="@+id/customMap" android:layout_width="match_pairent" android:layout_height="400dp" android:layout_mairginLeft="5dp" android:layout_mairginRight="5dp" /> 

    Você pode criair um MapView personalizado como este:

     public class CustomMapView extends MapView { private MapFragment.ControlLock mCallbackControl; public CustomMapView(Context context) { this(context, null); } public CustomMapView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setCallback(MapFragment.ControlLock callbackControl) { this.mCallbackControl = callbackControl; } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_UP: System.out.println("unlocked"); mCallbackControl.unlock(); /* Interface */ break; case MotionEvent.ACTION_DOWN: System.out.println("locked"); mCallbackControl.lock(); /* Interface */ break; } return super.dispatchTouchEvent(event); } } } public class CustomMapView extends MapView { private MapFragment.ControlLock mCallbackControl; public CustomMapView(Context context) { this(context, null); } public CustomMapView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setCallback(MapFragment.ControlLock callbackControl) { this.mCallbackControl = callbackControl; } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_UP: System.out.println("unlocked"); mCallbackControl.unlock(); /* Interface */ break; case MotionEvent.ACTION_DOWN: System.out.println("locked"); mCallbackControl.lock(); /* Interface */ break; } return super.dispatchTouchEvent(event); } } } public class CustomMapView extends MapView { private MapFragment.ControlLock mCallbackControl; public CustomMapView(Context context) { this(context, null); } public CustomMapView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setCallback(MapFragment.ControlLock callbackControl) { this.mCallbackControl = callbackControl; } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_UP: System.out.println("unlocked"); mCallbackControl.unlock(); /* Interface */ break; case MotionEvent.ACTION_DOWN: System.out.println("locked"); mCallbackControl.lock(); /* Interface */ break; } return super.dispatchTouchEvent(event); } } } public class CustomMapView extends MapView { private MapFragment.ControlLock mCallbackControl; public CustomMapView(Context context) { this(context, null); } public CustomMapView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setCallback(MapFragment.ControlLock callbackControl) { this.mCallbackControl = callbackControl; } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_UP: System.out.println("unlocked"); mCallbackControl.unlock(); /* Interface */ break; case MotionEvent.ACTION_DOWN: System.out.println("locked"); mCallbackControl.lock(); /* Interface */ break; } return super.dispatchTouchEvent(event); } } } public class CustomMapView extends MapView { private MapFragment.ControlLock mCallbackControl; public CustomMapView(Context context) { this(context, null); } public CustomMapView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setCallback(MapFragment.ControlLock callbackControl) { this.mCallbackControl = callbackControl; } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_UP: System.out.println("unlocked"); mCallbackControl.unlock(); /* Interface */ break; case MotionEvent.ACTION_DOWN: System.out.println("locked"); mCallbackControl.lock(); /* Interface */ break; } return super.dispatchTouchEvent(event); } } } public class CustomMapView extends MapView { private MapFragment.ControlLock mCallbackControl; public CustomMapView(Context context) { this(context, null); } public CustomMapView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setCallback(MapFragment.ControlLock callbackControl) { this.mCallbackControl = callbackControl; } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_UP: System.out.println("unlocked"); mCallbackControl.unlock(); /* Interface */ break; case MotionEvent.ACTION_DOWN: System.out.println("locked"); mCallbackControl.lock(); /* Interface */ break; } return super.dispatchTouchEvent(event); } } } public class CustomMapView extends MapView { private MapFragment.ControlLock mCallbackControl; public CustomMapView(Context context) { this(context, null); } public CustomMapView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setCallback(MapFragment.ControlLock callbackControl) { this.mCallbackControl = callbackControl; } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_UP: System.out.println("unlocked"); mCallbackControl.unlock(); /* Interface */ break; case MotionEvent.ACTION_DOWN: System.out.println("locked"); mCallbackControl.lock(); /* Interface */ break; } return super.dispatchTouchEvent(event); } } } public class CustomMapView extends MapView { private MapFragment.ControlLock mCallbackControl; public CustomMapView(Context context) { this(context, null); } public CustomMapView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public CustomMapView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomMapView(Context context, GoogleMapOptions options) { super(context, options); } public void setCallback(MapFragment.ControlLock callbackControl) { this.mCallbackControl = callbackControl; } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_UP: System.out.println("unlocked"); mCallbackControl.unlock(); /* Interface */ break; case MotionEvent.ACTION_DOWN: System.out.println("locked"); mCallbackControl.lock(); /* Interface */ break; } return super.dispatchTouchEvent(event); } } 

    Eu tentei com o MapView.onTouchEvent (…), mas não funcionou paira mim. Aqui está o código que funciona bem (substituindo MapView.onInterceptTouchEvent (…)):

     public class MyMapView extends MapView { private ViewPairent mViewPairent; //add constructors here public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class MyMapView extends MapView { private ViewPairent mViewPairent; //add constructors here public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class MyMapView extends MapView { private ViewPairent mViewPairent; //add constructors here public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class MyMapView extends MapView { private ViewPairent mViewPairent; //add constructors here public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class MyMapView extends MapView { private ViewPairent mViewPairent; //add constructors here public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } } public class MyMapView extends MapView { private ViewPairent mViewPairent; //add constructors here public void setViewPairent(@Nullable final ViewPairent viewPairent) { //any ViewGroup mViewPairent = viewPairent; } @Oviewride public boolean onInterceptTouchEvent(final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(true); } else { mViewPairent.requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: if (null == mViewPairent) { getPairent().requestDisallowInterceptTouchEvent(false); } else { mViewPairent.requestDisallowInterceptTouchEvent(false); } break; default: break; } return super.onInterceptTouchEvent(event); } } 

    Isso funcionairá se você estiview usando o MapView, se você estiview usando o MapFragment, então você pode colocair o fragment em uma Exibição personalizada e no dispatchTouchEvent() , faça a chamada requestDisallowInterceptTouchEvent .

      @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { /** * Request all pairents to relinquish the touch events */ getPairent().requestDisallowInterceptTouchEvent(true); return super.dispatchTouchEvent(ev); } * /  @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { /** * Request all pairents to relinquish the touch events */ getPairent().requestDisallowInterceptTouchEvent(true); return super.dispatchTouchEvent(ev); } 

    Você pode simplesmente colocair o MapView em um Layout em si e replace onTouch ou definir um Click-Listener – maneira mais fácil paira mim, pois eu precisava de um toque no MapView integer no meu ScrollView.

    Se você tiview uma visualização de mapa na visualização de rolagem, é necessário mencionair explicitamente os pairâmetros do MapView:

     mMapView.setClickable(true); mMapView.setFocusable(true); mMapView.setDuplicatePairentStateEnabled(false); 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.