2013-05-14 32 views
1

如何通過Google地點操作添加一個地名作爲英語的主要名稱,然後在不同語言的不同名稱上添加同一地點。它可能是主要的或不是主要的不同語言。 或Google對我們也一樣。GOOGLE Place Api:如何通過Google地點操作添加更多地名對單個地點

謝謝。

+0

對不起,我不是要求獲取地點細節,我的意思是要求如何爲單個地點添加更多姓名。例如,我通過提供語言爲英語的方式在地方行動中添加了地名(「新軟件解決方案」)。我得到了回覆{id,reference,status}。我想爲同一地點添加更多名稱。即我想在同一個地方添加另一個阿拉伯語名稱。我如何做到這一點?如果我能得到一些examaples,我將非常感激。謝謝。 – user2378154 2013-05-14 12:30:04

+0

你可以看到我的編輯。 – Dolphin 2013-05-14 12:52:39

回答

0

,你可以使自己的WindowAdapter的標誌物有2線名稱(例如)

這裏是MyInfoWIndowAdapter

public class MyInfoWindowAdapter implements InfoWindowAdapter { 

    private final View mView; 

    public MyInfoWindowAdapter(Activity activity) { 

     mView = activity.getLayoutInflater().inflate(R.layout.custom_info_window, null); 
    } 
    @Override 
    public View getInfoContents(Marker marker) { 

     String title = marker.getTitle(); 
     final String snippet = marker.getSnippet(); 
     final TextView titleUi1 = (TextView) mView.findViewById(R.id.title); 
     final TextView titleUi2 = (TextView) mView.findViewById(R.id.title2); 
     titleUi1.setText(title); 
     titleUi2.setText("Second name"); 
     return mView; 
    } 

    @Override 
    public View getInfoWindow(Marker marker) { 

     return null; 
    } 
} 

的custom_info_window的:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 

    <TextView 
     android:id="@+id/title" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_horizontal" 
     android:ellipsize="end" 
     android:paddingBottom="@dimen/padding_small" 
     android:singleLine="true" 
     android:textColor="@color/map_info_title" 
     android:textSize="@dimen/map_info_window_text" 
     android:textStyle="bold" /> 
    <TextView 
     android:id="@+id/title2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_horizontal" 
     android:ellipsize="end" 
     android:paddingBottom="@dimen/padding_small" 
     android:singleLine="true" 
     android:textColor="@color/map_info_title" 
     android:textSize="@dimen/map_info_window_text" 
     android:textStyle="bold" /> 
    <TextView 
     android:id="@+id/snippet" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textColor="@color/map_info_snippet" 
     android:textSize="@dimen/map_info_window_text" /> 
</LinearLayout> 

上Mapfragment,加這在onCreate

mMap.setInfoWindowAdapter(new MyInfoWindowAdapter(getActivity())); 
+0

如果可能,我需要在JavaScript或C#中使用 – user2378154 2013-05-15 10:17:30

+0

@ user2378154此示例來自android。我不知道JavaScript/C# – Dolphin 2013-05-15 10:25:38

+0

我仍然陷入困境,需要使用谷歌地點API的相同功能,因爲地圖製造商提供了爲單個地點添加更多名稱。 (請參閱多個名稱部分)<< https://support.google.com/mapmaker/answer/1096113?hl=zh_CN&ref_topic=2889732 >> – user2378154 2013-05-16 06:40:48

相關問題