首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在android线性布局中显示HereMaps

如何在android线性布局中显示HereMaps
EN

Stack Overflow用户
提问于 2017-09-17 03:02:32
回答 1查看 65关注 0票数 0

是否在线性布局中显示HereMaps?这是我的布局文件,我想用firstMap (LinearLayout)显示地图。

代码语言:javascript
复制
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.apploft.tabs.MyTabFragment">
<RelativeLayout
    android:id="@+id/confirmed"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/firstMap"
        android:layout_width="match_parent"
        android:layout_height="130dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="10dp"
        android:background="@color/cardview_shadow_start_color"
        android:orientation="horizontal">
        <!-- Map Fragment embedded with the map object -->
    </LinearLayout>
</FrameLayout>

通过在LinearLayout中添加maoview,然后调用

代码语言:javascript
复制
<com.here.android.mpa.mapping.MapView
             android:id="@+id/mapview"
             android:layout_width="fill_parent"
             android:layout_height="fill_parent"
             android:visibility="visible"/>

在碎片中

代码语言:javascript
复制
MapView mapColView = (MapView) colTabView.findViewById(R.id.mapview);
        map = new com.here.android.mpa.mapping.Map();
        map.setCenter(new GeoCoordinate(51.509865, -0.118092, 0.0), com.here.android.mpa.mapping.Map.Animation.NONE);
        // Set the zoom level to the average between min and max
        map.setZoomLevel((map.getMaxZoomLevel() + map.getMinZoomLevel()) / 2);
        mapColView.setMap(map);

还测试/检查onResume() onPause()。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-09-18 03:55:04

在本例中使用MapView而不是MapFragment。文档链接这里表示初学者,这里链接表示溢价。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46260248

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档