Google maps markerOptions size












2















I'm trying to increase the size of a google markerOptions because the text inside is not totally visible...



This is my code, i didn't find an option to set the size.



    MapsInitializer.initialize(getContext());
mGoogleMap = googleMap;
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
//Normalement on va devoir boucler sur toutes les coordonnées reçu pour créer tous les markers
googleMap
.addMarker(new MarkerOptions()
.position(new LatLng(50.200323, 4.897113))
.title("Collecte de Falmagne")
.snippet("Horaires de cette collecte : n Lundi : 10H00-15H00 n Mardi 13H00-17H00 n Mercredi 8H00-12H00")
);


And this is an image to show what is my problem



enter image description here



Thank you in advance and sorry for the bad english !










share|improve this question

























  • the marker or the info window?

    – armen
    Nov 26 '18 at 5:24











  • @armen the info window, i want to see all the text inside the info window

    – Gwynbleidd
    Nov 26 '18 at 18:39
















2















I'm trying to increase the size of a google markerOptions because the text inside is not totally visible...



This is my code, i didn't find an option to set the size.



    MapsInitializer.initialize(getContext());
mGoogleMap = googleMap;
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
//Normalement on va devoir boucler sur toutes les coordonnées reçu pour créer tous les markers
googleMap
.addMarker(new MarkerOptions()
.position(new LatLng(50.200323, 4.897113))
.title("Collecte de Falmagne")
.snippet("Horaires de cette collecte : n Lundi : 10H00-15H00 n Mardi 13H00-17H00 n Mercredi 8H00-12H00")
);


And this is an image to show what is my problem



enter image description here



Thank you in advance and sorry for the bad english !










share|improve this question

























  • the marker or the info window?

    – armen
    Nov 26 '18 at 5:24











  • @armen the info window, i want to see all the text inside the info window

    – Gwynbleidd
    Nov 26 '18 at 18:39














2












2








2








I'm trying to increase the size of a google markerOptions because the text inside is not totally visible...



This is my code, i didn't find an option to set the size.



    MapsInitializer.initialize(getContext());
mGoogleMap = googleMap;
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
//Normalement on va devoir boucler sur toutes les coordonnées reçu pour créer tous les markers
googleMap
.addMarker(new MarkerOptions()
.position(new LatLng(50.200323, 4.897113))
.title("Collecte de Falmagne")
.snippet("Horaires de cette collecte : n Lundi : 10H00-15H00 n Mardi 13H00-17H00 n Mercredi 8H00-12H00")
);


And this is an image to show what is my problem



enter image description here



Thank you in advance and sorry for the bad english !










share|improve this question
















I'm trying to increase the size of a google markerOptions because the text inside is not totally visible...



This is my code, i didn't find an option to set the size.



    MapsInitializer.initialize(getContext());
mGoogleMap = googleMap;
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
//Normalement on va devoir boucler sur toutes les coordonnées reçu pour créer tous les markers
googleMap
.addMarker(new MarkerOptions()
.position(new LatLng(50.200323, 4.897113))
.title("Collecte de Falmagne")
.snippet("Horaires de cette collecte : n Lundi : 10H00-15H00 n Mardi 13H00-17H00 n Mercredi 8H00-12H00")
);


And this is an image to show what is my problem



enter image description here



Thank you in advance and sorry for the bad english !







java android dictionary marker code-snippets






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 23:17









gratien asimbahwe

1,10431122




1,10431122










asked Nov 25 '18 at 16:26









GwynbleiddGwynbleidd

184




184













  • the marker or the info window?

    – armen
    Nov 26 '18 at 5:24











  • @armen the info window, i want to see all the text inside the info window

    – Gwynbleidd
    Nov 26 '18 at 18:39



















  • the marker or the info window?

    – armen
    Nov 26 '18 at 5:24











  • @armen the info window, i want to see all the text inside the info window

    – Gwynbleidd
    Nov 26 '18 at 18:39

















the marker or the info window?

– armen
Nov 26 '18 at 5:24





the marker or the info window?

– armen
Nov 26 '18 at 5:24













@armen the info window, i want to see all the text inside the info window

– Gwynbleidd
Nov 26 '18 at 18:39





@armen the info window, i want to see all the text inside the info window

– Gwynbleidd
Nov 26 '18 at 18:39












3 Answers
3






active

oldest

votes


















0














You can make custom info window , for displaying your data .



Firstly add marker to your map



      MarkerOptions options = new MarkerOptions()
.position(latLng)
.title(title).snippet(yoursnippet);
mMap.addMarker(options);


Then you can put InfoWindowAdapter of GoogleMap



mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {

@Override
public View getInfoWindow(Marker arg0) {
return null;
}

@Override
public View getInfoContents(Marker marker) {
//layout of your info window
LinearLayout info = new LinearLayout(mContext);
info.setOrientation(LinearLayout.VERTICAL);
//for displaying title
TextView title = new TextView(mContext);
title.setTextColor(Color.BLACK);
title.setGravity(Gravity.CENTER);
title.setTypeface(null, Typeface.BOLD);
title.setText(marker.getTitle());
//for displaying snippet
TextView snippet = new TextView(mContext);
snippet.setTextColor(Color.BLACK);
snippet.setText(marker.getSnippet());

info.addView(title); //Adding title in your custom window
info.addView(snippet); //adding description

return info;
}
});





share|improve this answer
























  • Thank you i'm going to test this !

    – Gwynbleidd
    Nov 26 '18 at 13:38











  • Does it worked? 🙂

    – Swati
    Nov 26 '18 at 15:44











  • I haven't tried yet ;)

    – Gwynbleidd
    Nov 26 '18 at 18:36











  • It works fine thank you very well ! Have a nice day :p

    – Gwynbleidd
    Dec 1 '18 at 15:23



















0














I think it's not possible to change the size of marker in Google maps.. but we can add a custom image or from Bitmap...



BitmapDrawable bitmapdraw=(BitmapDrawable)getResources().getDrawable(R.mipmap.marker); Bitmap b=bitmapdraw.getBitmap(); Bitmap ***marker*** = Bitmap.createScaledBitmap(b, 200, 400, false);

googleMap .addMarker(new MarkerOptions() .position(new LatLng(50.200323, 4.897113)) .title("Collecte de Falmagne") .icon(***marker***) .snippet("Horaires de cette collecte : ));





share|improve this answer


























  • Thank you i'm going to test this !

    – Gwynbleidd
    Nov 26 '18 at 13:38



















0














Another option is to create a Layout and add it to a Custom InfoWindowAdapter.



custom_info_window.xml:



 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingStart="5dp"
android:textColor="@color/blank"
android:textSize="24sp"
android:textStyle="bold" />

<TextView
android:id="@+id/tv_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/tv_title"
android:background="@color/white"
android:paddingLeft="5dp"
android:paddingStart="5dp"
android:singleLine="false"
android:textColor="@color/black"
android:textStyle="italic" />

</RelativeLayout>


Add the custom adapter inside your Activity/Fragment Map:



 private class CustomInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
@Override
public View getInfoWindow(Marker marker) {
View view = getActivity().getLayoutInflater().inflate(R.layout.custom_info_window, null);
TextView tvTitle = (TextView) view.findViewById(R.id.tv_title);
TextView tvSubTitle = (TextView) view.findViewById(R.id.tv_subtitle);

tvTitle.setText(marker.getTitle());
tvSubTitle.setText(marker.getSnippet());
return view;
}

@Override
public View getInfoContents(Marker marker) {
return null;
}
}





share|improve this answer
























  • Thanks i'm going to try this today if the other solutions don't work ;)

    – Gwynbleidd
    Dec 1 '18 at 6:39











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53469501%2fgoogle-maps-markeroptions-size%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You can make custom info window , for displaying your data .



Firstly add marker to your map



      MarkerOptions options = new MarkerOptions()
.position(latLng)
.title(title).snippet(yoursnippet);
mMap.addMarker(options);


Then you can put InfoWindowAdapter of GoogleMap



mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {

@Override
public View getInfoWindow(Marker arg0) {
return null;
}

@Override
public View getInfoContents(Marker marker) {
//layout of your info window
LinearLayout info = new LinearLayout(mContext);
info.setOrientation(LinearLayout.VERTICAL);
//for displaying title
TextView title = new TextView(mContext);
title.setTextColor(Color.BLACK);
title.setGravity(Gravity.CENTER);
title.setTypeface(null, Typeface.BOLD);
title.setText(marker.getTitle());
//for displaying snippet
TextView snippet = new TextView(mContext);
snippet.setTextColor(Color.BLACK);
snippet.setText(marker.getSnippet());

info.addView(title); //Adding title in your custom window
info.addView(snippet); //adding description

return info;
}
});





share|improve this answer
























  • Thank you i'm going to test this !

    – Gwynbleidd
    Nov 26 '18 at 13:38











  • Does it worked? 🙂

    – Swati
    Nov 26 '18 at 15:44











  • I haven't tried yet ;)

    – Gwynbleidd
    Nov 26 '18 at 18:36











  • It works fine thank you very well ! Have a nice day :p

    – Gwynbleidd
    Dec 1 '18 at 15:23
















0














You can make custom info window , for displaying your data .



Firstly add marker to your map



      MarkerOptions options = new MarkerOptions()
.position(latLng)
.title(title).snippet(yoursnippet);
mMap.addMarker(options);


Then you can put InfoWindowAdapter of GoogleMap



mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {

@Override
public View getInfoWindow(Marker arg0) {
return null;
}

@Override
public View getInfoContents(Marker marker) {
//layout of your info window
LinearLayout info = new LinearLayout(mContext);
info.setOrientation(LinearLayout.VERTICAL);
//for displaying title
TextView title = new TextView(mContext);
title.setTextColor(Color.BLACK);
title.setGravity(Gravity.CENTER);
title.setTypeface(null, Typeface.BOLD);
title.setText(marker.getTitle());
//for displaying snippet
TextView snippet = new TextView(mContext);
snippet.setTextColor(Color.BLACK);
snippet.setText(marker.getSnippet());

info.addView(title); //Adding title in your custom window
info.addView(snippet); //adding description

return info;
}
});





share|improve this answer
























  • Thank you i'm going to test this !

    – Gwynbleidd
    Nov 26 '18 at 13:38











  • Does it worked? 🙂

    – Swati
    Nov 26 '18 at 15:44











  • I haven't tried yet ;)

    – Gwynbleidd
    Nov 26 '18 at 18:36











  • It works fine thank you very well ! Have a nice day :p

    – Gwynbleidd
    Dec 1 '18 at 15:23














0












0








0







You can make custom info window , for displaying your data .



Firstly add marker to your map



      MarkerOptions options = new MarkerOptions()
.position(latLng)
.title(title).snippet(yoursnippet);
mMap.addMarker(options);


Then you can put InfoWindowAdapter of GoogleMap



mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {

@Override
public View getInfoWindow(Marker arg0) {
return null;
}

@Override
public View getInfoContents(Marker marker) {
//layout of your info window
LinearLayout info = new LinearLayout(mContext);
info.setOrientation(LinearLayout.VERTICAL);
//for displaying title
TextView title = new TextView(mContext);
title.setTextColor(Color.BLACK);
title.setGravity(Gravity.CENTER);
title.setTypeface(null, Typeface.BOLD);
title.setText(marker.getTitle());
//for displaying snippet
TextView snippet = new TextView(mContext);
snippet.setTextColor(Color.BLACK);
snippet.setText(marker.getSnippet());

info.addView(title); //Adding title in your custom window
info.addView(snippet); //adding description

return info;
}
});





share|improve this answer













You can make custom info window , for displaying your data .



Firstly add marker to your map



      MarkerOptions options = new MarkerOptions()
.position(latLng)
.title(title).snippet(yoursnippet);
mMap.addMarker(options);


Then you can put InfoWindowAdapter of GoogleMap



mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {

@Override
public View getInfoWindow(Marker arg0) {
return null;
}

@Override
public View getInfoContents(Marker marker) {
//layout of your info window
LinearLayout info = new LinearLayout(mContext);
info.setOrientation(LinearLayout.VERTICAL);
//for displaying title
TextView title = new TextView(mContext);
title.setTextColor(Color.BLACK);
title.setGravity(Gravity.CENTER);
title.setTypeface(null, Typeface.BOLD);
title.setText(marker.getTitle());
//for displaying snippet
TextView snippet = new TextView(mContext);
snippet.setTextColor(Color.BLACK);
snippet.setText(marker.getSnippet());

info.addView(title); //Adding title in your custom window
info.addView(snippet); //adding description

return info;
}
});






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 26 '18 at 5:45









SwatiSwati

424213




424213













  • Thank you i'm going to test this !

    – Gwynbleidd
    Nov 26 '18 at 13:38











  • Does it worked? 🙂

    – Swati
    Nov 26 '18 at 15:44











  • I haven't tried yet ;)

    – Gwynbleidd
    Nov 26 '18 at 18:36











  • It works fine thank you very well ! Have a nice day :p

    – Gwynbleidd
    Dec 1 '18 at 15:23



















  • Thank you i'm going to test this !

    – Gwynbleidd
    Nov 26 '18 at 13:38











  • Does it worked? 🙂

    – Swati
    Nov 26 '18 at 15:44











  • I haven't tried yet ;)

    – Gwynbleidd
    Nov 26 '18 at 18:36











  • It works fine thank you very well ! Have a nice day :p

    – Gwynbleidd
    Dec 1 '18 at 15:23

















Thank you i'm going to test this !

– Gwynbleidd
Nov 26 '18 at 13:38





Thank you i'm going to test this !

– Gwynbleidd
Nov 26 '18 at 13:38













Does it worked? 🙂

– Swati
Nov 26 '18 at 15:44





Does it worked? 🙂

– Swati
Nov 26 '18 at 15:44













I haven't tried yet ;)

– Gwynbleidd
Nov 26 '18 at 18:36





I haven't tried yet ;)

– Gwynbleidd
Nov 26 '18 at 18:36













It works fine thank you very well ! Have a nice day :p

– Gwynbleidd
Dec 1 '18 at 15:23





It works fine thank you very well ! Have a nice day :p

– Gwynbleidd
Dec 1 '18 at 15:23













0














I think it's not possible to change the size of marker in Google maps.. but we can add a custom image or from Bitmap...



BitmapDrawable bitmapdraw=(BitmapDrawable)getResources().getDrawable(R.mipmap.marker); Bitmap b=bitmapdraw.getBitmap(); Bitmap ***marker*** = Bitmap.createScaledBitmap(b, 200, 400, false);

googleMap .addMarker(new MarkerOptions() .position(new LatLng(50.200323, 4.897113)) .title("Collecte de Falmagne") .icon(***marker***) .snippet("Horaires de cette collecte : ));





share|improve this answer


























  • Thank you i'm going to test this !

    – Gwynbleidd
    Nov 26 '18 at 13:38
















0














I think it's not possible to change the size of marker in Google maps.. but we can add a custom image or from Bitmap...



BitmapDrawable bitmapdraw=(BitmapDrawable)getResources().getDrawable(R.mipmap.marker); Bitmap b=bitmapdraw.getBitmap(); Bitmap ***marker*** = Bitmap.createScaledBitmap(b, 200, 400, false);

googleMap .addMarker(new MarkerOptions() .position(new LatLng(50.200323, 4.897113)) .title("Collecte de Falmagne") .icon(***marker***) .snippet("Horaires de cette collecte : ));





share|improve this answer


























  • Thank you i'm going to test this !

    – Gwynbleidd
    Nov 26 '18 at 13:38














0












0








0







I think it's not possible to change the size of marker in Google maps.. but we can add a custom image or from Bitmap...



BitmapDrawable bitmapdraw=(BitmapDrawable)getResources().getDrawable(R.mipmap.marker); Bitmap b=bitmapdraw.getBitmap(); Bitmap ***marker*** = Bitmap.createScaledBitmap(b, 200, 400, false);

googleMap .addMarker(new MarkerOptions() .position(new LatLng(50.200323, 4.897113)) .title("Collecte de Falmagne") .icon(***marker***) .snippet("Horaires de cette collecte : ));





share|improve this answer















I think it's not possible to change the size of marker in Google maps.. but we can add a custom image or from Bitmap...



BitmapDrawable bitmapdraw=(BitmapDrawable)getResources().getDrawable(R.mipmap.marker); Bitmap b=bitmapdraw.getBitmap(); Bitmap ***marker*** = Bitmap.createScaledBitmap(b, 200, 400, false);

googleMap .addMarker(new MarkerOptions() .position(new LatLng(50.200323, 4.897113)) .title("Collecte de Falmagne") .icon(***marker***) .snippet("Horaires de cette collecte : ));






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 26 '18 at 6:30

























answered Nov 25 '18 at 17:40









satyan_androidsatyan_android

21619




21619













  • Thank you i'm going to test this !

    – Gwynbleidd
    Nov 26 '18 at 13:38



















  • Thank you i'm going to test this !

    – Gwynbleidd
    Nov 26 '18 at 13:38

















Thank you i'm going to test this !

– Gwynbleidd
Nov 26 '18 at 13:38





Thank you i'm going to test this !

– Gwynbleidd
Nov 26 '18 at 13:38











0














Another option is to create a Layout and add it to a Custom InfoWindowAdapter.



custom_info_window.xml:



 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingStart="5dp"
android:textColor="@color/blank"
android:textSize="24sp"
android:textStyle="bold" />

<TextView
android:id="@+id/tv_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/tv_title"
android:background="@color/white"
android:paddingLeft="5dp"
android:paddingStart="5dp"
android:singleLine="false"
android:textColor="@color/black"
android:textStyle="italic" />

</RelativeLayout>


Add the custom adapter inside your Activity/Fragment Map:



 private class CustomInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
@Override
public View getInfoWindow(Marker marker) {
View view = getActivity().getLayoutInflater().inflate(R.layout.custom_info_window, null);
TextView tvTitle = (TextView) view.findViewById(R.id.tv_title);
TextView tvSubTitle = (TextView) view.findViewById(R.id.tv_subtitle);

tvTitle.setText(marker.getTitle());
tvSubTitle.setText(marker.getSnippet());
return view;
}

@Override
public View getInfoContents(Marker marker) {
return null;
}
}





share|improve this answer
























  • Thanks i'm going to try this today if the other solutions don't work ;)

    – Gwynbleidd
    Dec 1 '18 at 6:39
















0














Another option is to create a Layout and add it to a Custom InfoWindowAdapter.



custom_info_window.xml:



 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingStart="5dp"
android:textColor="@color/blank"
android:textSize="24sp"
android:textStyle="bold" />

<TextView
android:id="@+id/tv_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/tv_title"
android:background="@color/white"
android:paddingLeft="5dp"
android:paddingStart="5dp"
android:singleLine="false"
android:textColor="@color/black"
android:textStyle="italic" />

</RelativeLayout>


Add the custom adapter inside your Activity/Fragment Map:



 private class CustomInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
@Override
public View getInfoWindow(Marker marker) {
View view = getActivity().getLayoutInflater().inflate(R.layout.custom_info_window, null);
TextView tvTitle = (TextView) view.findViewById(R.id.tv_title);
TextView tvSubTitle = (TextView) view.findViewById(R.id.tv_subtitle);

tvTitle.setText(marker.getTitle());
tvSubTitle.setText(marker.getSnippet());
return view;
}

@Override
public View getInfoContents(Marker marker) {
return null;
}
}





share|improve this answer
























  • Thanks i'm going to try this today if the other solutions don't work ;)

    – Gwynbleidd
    Dec 1 '18 at 6:39














0












0








0







Another option is to create a Layout and add it to a Custom InfoWindowAdapter.



custom_info_window.xml:



 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingStart="5dp"
android:textColor="@color/blank"
android:textSize="24sp"
android:textStyle="bold" />

<TextView
android:id="@+id/tv_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/tv_title"
android:background="@color/white"
android:paddingLeft="5dp"
android:paddingStart="5dp"
android:singleLine="false"
android:textColor="@color/black"
android:textStyle="italic" />

</RelativeLayout>


Add the custom adapter inside your Activity/Fragment Map:



 private class CustomInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
@Override
public View getInfoWindow(Marker marker) {
View view = getActivity().getLayoutInflater().inflate(R.layout.custom_info_window, null);
TextView tvTitle = (TextView) view.findViewById(R.id.tv_title);
TextView tvSubTitle = (TextView) view.findViewById(R.id.tv_subtitle);

tvTitle.setText(marker.getTitle());
tvSubTitle.setText(marker.getSnippet());
return view;
}

@Override
public View getInfoContents(Marker marker) {
return null;
}
}





share|improve this answer













Another option is to create a Layout and add it to a Custom InfoWindowAdapter.



custom_info_window.xml:



 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingStart="5dp"
android:textColor="@color/blank"
android:textSize="24sp"
android:textStyle="bold" />

<TextView
android:id="@+id/tv_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/tv_title"
android:background="@color/white"
android:paddingLeft="5dp"
android:paddingStart="5dp"
android:singleLine="false"
android:textColor="@color/black"
android:textStyle="italic" />

</RelativeLayout>


Add the custom adapter inside your Activity/Fragment Map:



 private class CustomInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
@Override
public View getInfoWindow(Marker marker) {
View view = getActivity().getLayoutInflater().inflate(R.layout.custom_info_window, null);
TextView tvTitle = (TextView) view.findViewById(R.id.tv_title);
TextView tvSubTitle = (TextView) view.findViewById(R.id.tv_subtitle);

tvTitle.setText(marker.getTitle());
tvSubTitle.setText(marker.getSnippet());
return view;
}

@Override
public View getInfoContents(Marker marker) {
return null;
}
}






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 26 '18 at 22:28









armenarmen

22125




22125













  • Thanks i'm going to try this today if the other solutions don't work ;)

    – Gwynbleidd
    Dec 1 '18 at 6:39



















  • Thanks i'm going to try this today if the other solutions don't work ;)

    – Gwynbleidd
    Dec 1 '18 at 6:39

















Thanks i'm going to try this today if the other solutions don't work ;)

– Gwynbleidd
Dec 1 '18 at 6:39





Thanks i'm going to try this today if the other solutions don't work ;)

– Gwynbleidd
Dec 1 '18 at 6:39


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53469501%2fgoogle-maps-markeroptions-size%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python