Reputation: 61
I have a google map application (using google-maps:16). ProgressView is the custom class layout which I used to display ProgressBar with text inside it. The issue is that when I go to map fragment, if gps is on then, it will try to fetch user current location. While fetching current location, to show progress I am displaying ProgressView with some text above MapView. There is a back button in the toolbar. Whenever I click that back button in toolbar, sometimes the part of google map behind the ProgressView is flickering. This is happening only sometimes. And it is only coming when I am running my app on Samsung Galaxy S8 (API 26).
The flickering doesn't appear when I remove the ProgressView from the layout but the progress view is need to show. Below it the layout of that fragment:
<FrameLayout
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"
map:cameraTargetLat="33.753746"
map:cameraTargetLng="-84.386330"
map:cameraZoom="14" />
<ProgressView
android:id="@+id/findProgressView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone" />
</FrameLayout>
The expected result is that google map should not flicker with ProgressView.
Upvotes: 3
Views: 1964
Reputation: 51
Had a similar problem, where the MapView
was flickering on specifically pressing the back button of the Toolbar
.
I did try testing Andrey Smolyak's answer and it actually seemed to work.
Although, the final way I did it was to change the LayerType
of the MapView
to "hardware accelerated" in XML.
<com.google.android.gms.maps.MapView
android:id="@+id/mapView"
android:layerType="hardware"
android:layout_width="match_parent"
android:layout_height="match_parent" />
The same can be achieved in Java/Kotlin code:
mapView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
Upvotes: 5
Reputation: 43
I've faced same problem. I suppose that ripple animation on toolbar button is somehow affecting google maps.
You can disable ripple animation for back button on toolbar. I know it's dirty hack, but it fixes that problem in my case.
Upvotes: 1