Java 如何制作像uber这样的标记标签?
我想在我的标记旁边放置一个类似uber应用程序中的标记。如何在谷歌地图中制作这样的标签 我已经尝试添加标题和片段。但这不是我想要的Java 如何制作像uber这样的标记标签?,java,android,google-maps,bitmap,google-maps-markers,Java,Android,Google Maps,Bitmap,Google Maps Markers,我想在我的标记旁边放置一个类似uber应用程序中的标记。如何在谷歌地图中制作这样的标签 我已经尝试添加标题和片段。但这不是我想要的 mMap.addMarker(new MarkerOptions() .position(MELBOURNE) .title("6 min away") .snippet("Pick up point ")
mMap.addMarker(new MarkerOptions()
.position(MELBOURNE)
.title("6 min away")
.snippet("Pick up point ")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.pickup_2x)));
这就是我得到的@Nirmal答案。这仍然不是我想要的
info\u window\u 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
这没有帮助。这仍然不是我想要的。我用你答案中的图片编辑了我的帖子。你必须在地图上实现信息窗口,并将此布局充气到你的信息窗口中。哦,好的,我现在知道了。我已经用getInfoContents
,而不是getInfoWindow
给它充气了。再次感谢@Nirmalprajapt这里什么是wm.com.taxiapp.view.CustomTextView?@JayRathodRJ,我刚刚自定义了TextView,您可以自定义或使用普通的TextView。