スニペットの文字列を中央に揃えたい。
また、スニペットの改行(\n)はスペースに変換されますが、改行を挿入する方法はありますか?
私の関連コード:
GoogleMap map = ...
map.addMarker(new MarkerOptions().position(pos)
.title("title")
.snippet("body \n and mind");
ありがとう
スニペットの文字列を中央に揃えたい。
また、スニペットの改行(\n)はスペースに変換されますが、改行を挿入する方法はありますか?
私の関連コード:
GoogleMap map = ...
map.addMarker(new MarkerOptions().position(pos)
.title("title")
.snippet("body \n and mind");
ありがとう
いくつかの例と次の回答を使用して: custom info window adapter with custom data in map v2、次の解決策に出くわしました。
マーカー.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" />
</RelativeLayout>
ジャワ:
map.setInfoWindowAdapter(new InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker arg0) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
View v = getLayoutInflater().inflate(R.layout.marker, null);
TextView info= (TextView) v.findViewById(R.id.info);
info.setText(marker.getPosition().toString());
return v;
}
});