
我正在搜索这样一个没有工具提示箭头的文本框。当我查看android google地图功能时,它看起来是这样的:
sample googleMap snippet, notice the arrow
我该如何隐藏箭头呢?这些都是定制的吗?
发布于 2019-07-12 18:19:36
使用谷歌地图util库中的iconGenerator很容易做到这一点:
val iconGenerator = IconGenerator(activity)
val window = activity.layoutInflater.inflate(R.layout.myinfo_window,null)
iconGenerator.setContentView(window)
iconGenerator.setBackground(activity.getDrawableCompat(R.drawable.mybox_bg))
return googleMap.addMarker(MarkerOptions()
.position(location)
.icon(BitmapDescriptorFactory.fromBitmap(iconGenerator.makeIcon())))然后,myinfo_window.xml看起来像这样:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:padding="13dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cool LOCATION"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
</android.support.constraint.ConstraintLayout>注意:R.drawable.mybox_bg是一个可绘制的9补丁。
发布于 2019-07-12 18:22:51
你可以很容易地添加信息窗口到谷歌地图。
静态最终LatLng墨尔本=新LatLng(-37.81319,144.96298);标记墨尔本=mMap.addMarker(新MarkerOptions() .position(墨尔本).title(“墨尔本”));melbourne.showInfoWindow();
https://stackoverflow.com/questions/56862505
复制相似问题