Is it possible to customize a Bookmark InfoWindow in GoogleMaps v2 from Android by placing clickable buttons, images, changing the background color etc?
If yes, how can I do this? Thanks if anyone has a tutorial on the subject
Is it possible to customize a Bookmark InfoWindow in GoogleMaps v2 from Android by placing clickable buttons, images, changing the background color etc?
If yes, how can I do this? Thanks if anyone has a tutorial on the subject
And, yes, there is this tutorial Markers and Listeners Google Maps which explains super well how to do and follows an example below.
map.setInfoWindowAdapter(new InfoWindowAdapter(){
@Override
public View getInfoWindow(Marker marker) {
LinearLayout ll = new LinearLayout(MainActivity.this);
ll.setPadding(20, 20, 20, 20);
ll.setBackgroundColor(Color.GREEN);
TextView tv = new TextView(MainActivity.this);
tv.setText(Html.fromHtml("<b><font color=\"#ffffff\">"+marker.getTitle()+":</font></b> "+marker.getSnippet()));
ll.addView(tv);
Button bt = new Button(MainActivity.this);
bt.setText("Botão");
bt.setBackgroundColor(Color.RED);
bt.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View v) {
Log.i("Script", "Botão clicado");
}
});
ll.addView(bt);
return ll;
}
});