我正在使用这里的android SDK,并开始使用BasicMapSolution教程.现在我想在地图的顶部添加按钮(放大缩小到我的位置).不幸的是,我没有弄清楚如何做到这一点.我试着在activity_main.xml中添加一个按钮,像这样。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<!-- Map Fragment embedded with the map object -->
<fragment
android:id="@+id/mapfragment"
class="com.here.android.mpa.mapping.AndroidXMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/activity_main">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|top"
android:text="Demo Button"
android:padding="10dp"
android:layout_marginTop="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"/>
</fragment>
</LinearLayout>
但是这个按钮在应用中没有显示出来。有谁能帮助我吗?只是为了说明一下,我想实现这样的东西。
谢谢
马库斯
你是不是不能用2个手指点击来进行缩放?https:/developer.here.commobile-sdksdocumentationandroid-hybrid-plustopicsmap-gestures.html。也可以自定义地图手势。如果需要添加缩放控件,那么你可以在高级SDK中添加一个未知类型的地图标记对象,并在其监听器上传递最小最大范围的缩放。目前,传统的zoom inzoom按钮控件还不能使用,你可以参考下面的API文档来查看地图对象和缩放范围的细节。
https:/developer.here.comdocumentationandroid-premium3.15api_reference_javaindex.html。
也可以参考我们的github例子,了解已经有的地图标记对象和手势>。