I've managed to get a snackbar show successfully using a coordinator layout wrapped around a MapView in a fragment. The map view successfully slides up to allow room for the snackbar, however, once the snackbar has gone, the view stays were it is and leaves a white bar where the snackbar would appear. How can I fix this? I'm currently applying the following code as a behavior on the map view:
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight());
child.setTranslationY(translationY);
return true;
}
@Override
public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
// we only want to trigger the change
// only when the changes is from a snackbar
return dependency instanceof Snackbar.SnackbarLayout;
}
and my fragments view is this:
<android.support.design.widget.CoordinatorLayout
android:id="@+id/places_coordinator_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.gms.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="com.adamshort.canieatthis.FloatingActionButtonBehaviour"/>
</android.support.design.widget.CoordinatorLayout>
I've tried searching around, but either I'm searching for the wrong thing or I no one's had a similar issue. I've seen the behavior code I have posted and working successfully in various tutorials and videos, but it doesn't behave well with the map view. Any thoughts?
Aucun commentaire:
Enregistrer un commentaire