Good day. There is an application whose functionality needs to be partially copied. How to add controls to mapview? Thank you in advance.
|
1 answer
The easiest option is to make a layout in which the buttons are located above the map.
Something like that:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <com.google.android.maps.MapView android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="wrap_content" android:apiKey="mykey" android:clickable="true" /> <Button android:id="@+id/button" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true"/> </RelativeLayout>
More complex, and perhaps more correct - use overlay. But with this, I unfortunately cannot help anything ...
- I also thought about it, but it does not solve the problem of side elements, maybe there is some standard solution? can't even imagine how it should sound to google - gadfil
- one[Here] [1] that I googled ... it's on stack ... I think it should help. Look through all the answers, there you can find something useful in the rest too ... [1]: stackoverflow.com/a/5985426/1659629 - Vladyslav Matviienko
- oneoverlay as buttons? this is not getting what you need in the answer is the correct example, you have to dance from it :) - andreich
- Thank you, for the "clever" harm I will add remove setMyLocationEnabled and draw on top of everything you need)) developers.google.com/maps/documentation/android/interactivity - gadfil
|