相关疑难解决方法(0)

Android Google Maps v2:如何使用多行代码段添加标记?

有人知道如何将多行代码段添加到Google地图标记吗?这是我添加标记的代码:

map.getMap().addMarker(new MarkerOptions()
    .position(latLng()).snippet(snippetText)
    .title(header).icon(icon));
Run Code Online (Sandbox Code Playgroud)

我想要片段看起来像这样:

| HEADER |
|foo     |
|bar     |
Run Code Online (Sandbox Code Playgroud)

但是当我试图将snippetText设置为"foo \n bar"时,我看到了foo bar,我没有任何想法如何使它成为多线.你能帮助我吗?

android google-maps

64
推荐指数
3
解决办法
7万
查看次数

自定义信息窗口适配器,具有map v2中的自定义数据

我想在android中的map v2中制作自定义信息窗口适配器,如下所示.

在此输入图像描述

我已经看到下面的链接,但没有得到更多.

1,2,3,

下面是我的内容布局文件.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" 
>
    <ImageView
        android:id="@+id/infocontent_iv_image"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_alignParentTop="true" 
    />
    <RelativeLayout
        android:id="@+id/infocontent_rl_middle"
        android:layout_below="@id/infocontent_iv_image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:layout_margin="5dp"
    >

    </RelativeLayout>
    <TextView
        android:id="@+id/infocontent_tv_name"
        android:layout_below="@id/infocontent_rl_middle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textStyle="bold" 
        android:layout_margin="5dp"
    />
    <TextView
        android:id="@+id/infocontent_tv_type"
        android:layout_below="@id/infocontent_tv_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#CCCCCC"
        android:layout_margin="5dp"
    />
    <TextView
        android:id="@+id/infocontent_tv_desc"
        android:layout_below="@id/infocontent_tv_type"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
    />
    <TextView
        android:id="@+id/infocontent_tv_addr"
        android:layout_below="@id/infocontent_tv_desc"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
    />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

所以任何人都可以帮助我如何将数据设置为infowindow适配器中的所有视图?

android infowindow android-maps-v2

41
推荐指数
2
解决办法
8万
查看次数