Zoom controls are not displayed when using MapView with fill_parent

Hi everyone, I am working on applications and I use the built-in zoom controls. When using a specific size, I can see the magnification controls. When using fill_parent, the magnification controls are not visible. How to set it up is a mapview inside the frame layout (also using the parent fill for height and width, but with a shift down the screen. The only thing I can think of is the problem with parent filling using the framelayout and zoom functions left the screen Sorry if this is confusing, I embarrassed myself by writing it. Thanks in advance

+3
source share
2 answers

Had a similar problem trying to get the zoom controls working on my application.

It has been found that the layout for MapView MUST be set to "clickable" in order for the zoom controls to display and be operational. They don’t even show if the map

Here is a simple layout from the Android SDK site that shows the tag in the layout.

<com.google.android.maps.MapView
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:apiKey="Your Maps API Key" />

After placing this tag in the layout, everything works correctly.

+5
source

You can use ZoomControls like this.

ZoomControls mapZoomControl = (ZoomControls) findViewById(R.id.zcMapZoomControl);
mapZoomControl.setOnZoomInClickListener(new OnClickListener() {
        public void onClick(View v) {
            myMap.getController().zoomIn();
        }
});
    mapZoomControl.setOnZoomOutClickListener(new OnClickListener() {
        public void onClick(View v) {
            myMap.getController().zoomOut();
        }
});
+1
source

Source: https://habr.com/ru/post/1748848/


All Articles