活动中使用的布局(对于GoogleMap)
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cl_map"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/fr_map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.activity.MapActivity" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
在同一活动中,这是单击标记时创建小吃店的方式。
override fun onMarkerClick(p0: Marker?): Boolean {
Snackbar.make(findViewById(R.id.cl_map), "Hello World", Snackbar.LENGTH_INDEFINITE).show()
// finding android.R.id.content does not work either
// Snackbar.make(findViewById(android.R.id.content), "Hello World", Snackbar.LENGTH_INDEFINITE).show()
return false
}
以下是屏幕截图和一些症状:对于标记的初始点击:请注意黑色细线。那是小吃店。
但是,如果我单击地图正文中的任何地方而不是标记,则小吃店将恢复正常。
此外,如果将uiSettings.isMapToolbarEnabled设置为false,则默认工具栏将被隐藏,但小吃店将永远不会显示。无论我单击什么,我什至都看不到黑色的细线。
this.googleMap?.uiSettings?.isMapToolbarEnabled = false
[一个类似的问题here。我从屏幕快照中获取的电话是Nexus5。原生Android 6.0.1,Nexus 5可以支持的最新操作系统。
根本原因已被发现。在全屏模式下,小吃栏被SystemUI隐藏。可以很容易地复制此问题here。