MapView overdraw + fix

718
1
09-26-2013 12:00 AM
JuliusBagdonas
New Contributor
There some really simple drawing optimizations that can be implemented on MapView. Just sharing them.

For example, take com.esri.arcgis.android.samples.helloworld. Set target android:targetSdkVersion="18" in manifest and target=android-18 in project.properties (actually, anything above android-10 will work). Now go to device Settings -> Developer options and enable "Show GPU overdraw" option. Start the sample. As you can see, map now has green overlay on it, meaning that there are 2 things overdrawing on the area the map is in.

1) Window background. It can be removed by calling getWindow().setBackgroundDrawable(null); somewhere in activity. This optmization might not be suitable for apps that don't have MapView covering their whole window.

2) MapView background drawable. Why does the MapView need background drawable? Who knows... but you can remove it by calling mMapView.setBackgroundDrawable(null);

Hierarchy Viewer shows ~3ms decrease in drawing time.
0 Kudos
1 Reply
ThomasBinu
New Contributor III
There some really simple drawing optimizations that can be implemented on MapView. Just sharing them.

For example, take com.esri.arcgis.android.samples.helloworld. Set target android:targetSdkVersion="18" in manifest and target=android-18 in project.properties (actually, anything above android-10 will work). Now go to device Settings -> Developer options and enable "Show GPU overdraw" option. Start the sample. As you can see, map now has green overlay on it, meaning that there are 2 things overdrawing on the area the map is in.

1) Window background. It can be removed by calling getWindow().setBackgroundDrawable(null); somewhere in activity. This optmization might not be suitable for apps that don't have MapView covering their whole window.

2) MapView background drawable. Why does the MapView need background drawable? Who knows... but you can remove it by calling mMapView.setBackgroundDrawable(null);

Hierarchy Viewer shows ~3ms decrease in drawing time.


Thank you for sharing Chirrup!.
0 Kudos