Last active
December 11, 2015 10:58
-
-
Save pwittchen/4589974 to your computer and use it in GitHub Desktop.
Fixing bug with disappearing map overlay after zoom in Android.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExamplaryMapActivity extends RoboMapActivity { | |
@InjectView(R.id.mapview) | |
private MapView mapView; | |
@Override | |
protected void onCreate(Bundle bundle) { | |
enableHWAccel(mapView, false); | |
} | |
@TargetApi(11) | |
private static void enableHWAccel(MapView mapView, boolean enable) { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { | |
int type = enable ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_SOFTWARE; | |
mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment