如何在地图上单击标记的坐标处显示自定义对话框。目前我能够显示我选择的对话框,但它的位置并不准确。 以下是代码示例:
LayoutInflater layoutInflater = LayoutInflater.from(this);
View promptView = layoutInflater.inflate(R.layout.custom_info_window, null);
Dialog alertD = new Dialog(context);
alertD.requestWindowFeature(Window.FEATURE_NO_TITLE);
alertD.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
alertD.getWindow().setLayout(40, 40);
Point markerScreenPosition = mMap.getProjection().toScreenLocation(marker.getPosition());
WindowManager.LayoutParams wmlp = alertD.getWindow().getAttributes();
wmlp.x = markerScreenPosition.x;
wmlp.y = markerScreenPosition.y;