2017-11-30 4 views
1

私のマーカーの横にあるユーバーアプリのようなタグを表示したい。このようなタグをGoogleマップで作成するにはどうすればよいですか?uberのようなマーカータグを作るには?

すでにタイトルとスニペットを追加しようとしています。しかし、それは私が探しているものではありません。

mMap.addMarker(new MarkerOptions() 
         .position(MELBOURNE) 
         .title("6 min away") 
         .snippet("Pick up point ") 
         .icon(BitmapDescriptorFactory.fromResource(R.drawable.pickup_2x))); 

enter image description here

これは私が@Nirmal答えを得たものです。そのまだない私が欲しいものを正確に This is what i got with @Nirmal answer. Its still not what I want exactly

答えて

3

info_window_layout.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@android:color/white" 
    android:orientation="horizontal"> 

    <wm.com.taxiapp.view.CustomTextView 
     android:id="@+id/tv_distance" 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_weight="2.5" 
     android:background="@android:color/black" 
     android:gravity="center" 
     android:paddingLeft="@dimen/space_10" 
     android:paddingRight="@dimen/space_10" 
     android:text="2\nMIN" 
     android:textColor="@android:color/white" 
     android:textSize="@dimen/font_8" /> 

    <ImageView 
     android:id="@+id/iv_scheduled_ride" 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_weight="2.5" 
     android:background="@android:color/black" 
     android:gravity="center" 
     android:paddingLeft="@dimen/space_10" 
     android:paddingRight="@dimen/space_10" 
     android:src="@drawable/time" 
     android:visibility="gone" /> 

    <LinearLayout 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="6" 
     android:background="@android:color/white" 
     android:orientation="vertical"> 

     <wm.com.taxiapp.view.CustomTextView 
      android:id="@+id/tv_lat" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:ellipsize="end" 
      android:maxLines="1" 
      android:paddingLeft="@dimen/space_5" 
      android:paddingRight="@dimen/space_5" 
      android:paddingTop="@dimen/space_3dp" 
      android:scrollbars="none" 
      android:text=" " 
      android:textColor="@color/hintColor" 
      android:textSize="@dimen/font_12" /> 

     <wm.com.taxiapp.view.CustomTextView 
      android:id="@+id/tv_lng" 
      android:layout_width="@dimen/space_100" 
      android:layout_height="match_parent" 
      android:ellipsize="end" 
      android:maxLines="1" 
      android:paddingBottom="@dimen/space_3dp" 
      android:paddingLeft="@dimen/space_5" 
      android:scrollbars="none" 
      android:text="" 
      android:textColor="@color/hintColor" 
      android:textSize="@dimen/font_12" /> 

    </LinearLayout> 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:src="@drawable/arrow_right" /> 

</LinearLayout> 

は、情報ウィンドウで、このレイアウトファイルmMap.setInfoWindowAdapter

+0

歓迎、幸せなコーディングを膨らま!! –

+0

これは役に立ちません。それでも私は欲しいものではありません。私はあなたの答えを得たイメージで私のポストを編集しました。 –

+1

あなたは地図上にinfowindowを実装し、このレイアウトをあなたのインフォメーションウィンドウに展開する必要があります。 –

関連する問題