Google maps markerOptions size
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
Thank you in advance and sorry for the bad english !
java android dictionary marker code-snippets
add a comment |
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
Thank you in advance and sorry for the bad english !
java android dictionary marker code-snippets
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
add a comment |
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
Thank you in advance and sorry for the bad english !
java android dictionary marker code-snippets
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
Thank you in advance and sorry for the bad english !
java android dictionary marker code-snippets
java android dictionary marker code-snippets
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
add a comment |
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
add a comment |
3 Answers
3
active
oldest
votes
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;
}
});
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
add a comment |
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 : ));
Thank you i'm going to test this !
– Gwynbleidd
Nov 26 '18 at 13:38
add a comment |
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;
}
}
Thanks i'm going to try this today if the other solutions don't work ;)
– Gwynbleidd
Dec 1 '18 at 6:39
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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;
}
});
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
add a comment |
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;
}
});
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
add a comment |
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;
}
});
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;
}
});
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
add a comment |
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
add a comment |
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 : ));
Thank you i'm going to test this !
– Gwynbleidd
Nov 26 '18 at 13:38
add a comment |
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 : ));
Thank you i'm going to test this !
– Gwynbleidd
Nov 26 '18 at 13:38
add a comment |
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 : ));
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 : ));
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
add a comment |
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
add a comment |
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;
}
}
Thanks i'm going to try this today if the other solutions don't work ;)
– Gwynbleidd
Dec 1 '18 at 6:39
add a comment |
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;
}
}
Thanks i'm going to try this today if the other solutions don't work ;)
– Gwynbleidd
Dec 1 '18 at 6:39
add a comment |
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;
}
}
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;
}
}
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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