我有showmappins方法,它从服务器返回多个书签并在地图上修复它们。我使用googlemaps API。
方法:
//show map markers
private void showMapPins(double lat, double lng, String pin, String address, String hora, String dia) {
LatLng location = new LatLng(lat, lng);
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(location);
.....
switch (pin) {
case "1":
map.addMarker(new MarkerOptions().position(location).title("Some Title").snippet(endereco).icon(BitmapDescriptorFactory.fromResource(R.drawable.somepng)));
break;
}
map.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker arg0) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
LinearLayout info = new LinearLayout(activity);
info.setOrientation(LinearLayout.VERTICAL);
TextView title = new TextView(activity);
title.setTextColor(Color.BLACK);
title.setGravity(Gravity.CENTER);
title.setTypeface(null, Typeface.BOLD);
title.setText(marker.getTitle());
TextView snippet = new TextView(activity);
snippet.setTextColor(Color.GRAY);
snippet.setText(marker.getSnippet());
info.addView(title);
info.addView(snippet);
return info;
}
});
}
单击书签可打开有关书签的信息,并显示按钮以在googlemaps上生成路线。图像:
但我的浮动按钮超过了这些按钮。是否可以改变位置,如果可能的话,改变它的大小?
谢谢。