MapView in NestedScrollView scrollt nicht
Meine Kartenansicht in XML wie folgt aufblasen
<android.support.v4.widget.NestedScrollView
android:id="@+id/sv_offers"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="56dp"
android:visibility="gone"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.xys.widgets.CustomMapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="125dp"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
Und ich habe die benutzerdefinierte Kartenansicht wie folgt implementiert: -
public class CustomMapView extends MapView {
private ViewParent mViewParent;
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 void setViewParent(@Nullable final ViewParent viewParent) { //any ViewGroup
mViewParent = viewParent;
}
public CustomMapView(Context context, GoogleMapOptions options) {
super(context, options);
}
@Override
public boolean onInterceptTouchEvent(final MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (null == mViewParent) {
getParent().requestDisallowInterceptTouchEvent(true);
Timber.d("Inside if of action down");
} else {
mViewParent.requestDisallowInterceptTouchEvent(true);
Timber.d("Inside else of action down");
}
break;
case MotionEvent.ACTION_UP:
if (null == mViewParent) {
getParent().requestDisallowInterceptTouchEvent(false);
Timber.d("Inside if of action up");
} else {
mViewParent.requestDisallowInterceptTouchEvent(false);
Timber.d("Inside else of action up");
}
break;
default:
break;
}
return super.onInterceptTouchEvent(event);
}
}
Und meine Kartenansicht in onCreate () meiner Aktivität integriert
mapView = (CustomMapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
GoogleMap googleMap = mapView.getMap();
googleMap.setMyLocationEnabled(false);
googleMap.getUiSettings().setMyLocationButtonEnabled(false);
googleMap.getUiSettings().setCompassEnabled(false);
googleMap.getUiSettings().setAllGesturesEnabled(false);
mapView.setViewParent(nestedScrollContainer);
WonestedScrollContainer
ist meine verschachtelte scrollView.Tried viele Problemumgehungen in SO zur Verfügung gestellt, aber kann nicht scheinen, eine Problemumgehung für das Scrollen Problem zu bekommen.Hilfe wäre dankbar! Danke