Try this.
marker.setInfoWindowAnchor(1f,1f)
https://developers.google.com/android/reference/com/google/android/gms/maps/model/Marker#public-void-setinfowindowanchor-float-anchoru,-float-anchorv
Edit:
For a custom infoWindow you have to make a concrete implementation of GoogleMap.InfoWindowAdapter and inflate your custom_info_window_layout.xml file in the getInfoWindow(Marker marker) method.
public class CustomInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
Activity context;
CustomInfoWindow(Activity context){
this.context =context;
}
@Override
public View getInfoWindow(Marker marker) {
View view = context.getLayoutInflater().inflate(R.layout.custom_info_window_layout, null);
TextView title =(TextView) view.findViewById(R.id.tv_title);
TextView snippet =(TextView) view.findViewById(R.id.tv_snippet);
title.setText(marker.getTitle());
snippet.setText(marker.getSnippet());
return view;
}
@Override
public View getInfoContents(Marker marker) {
return null;
}
}
And finally set this CustomInfoWindowAdapter on the map.
map.setInfoWindowAdapter(new CustomInfoWindowAdapter(MainActivity.this))