How to display a Google Static Map in Android Textview
I have a TextView in an ExpandableList and I am setting the TextView's text through Html.fromHtml()
. I am trying to display a Static Google Map in the Textview and have it act as a button. Here is the link of a sample Google Static Map snippet that I'd like to include...
http://maps.google.com/maps/api/staticmap?center=37.386052,-122.083851&zoom=13&markers=size:mid|color:blue|37.386052,-122.083851&path=color:0x0000FF80|weight:5|37.40276,-122.06360&size=220x150&sensor=false
Here is how I'm trying to do it. Notice me trying to display the image at the end of infoString
String infoString = ("<img src='map.png'><b> Address: </b>" + address + ", Boston, MA 02210<br />" +
"<img src='star.png'><b> Rating: </b>" + rating + " out of 5" + "<br />" +
"<img src='phone.png'><b> Phone: </b> <a href="tel:" + phoneDial +"">" + phoneDisplay + "</a>" + "<br />" +
"<img src='yelp.png'><b> Yelp: </b> <a href="" + url + "">Click Here</a> <br />" +
"<a href='mailto:nomail@mail.com'><img src='http://maps.google.com/maps/api/staticmap?center=37.386052,-122.083851&zoom=13&markers=size:mid|color:blue|37.386052,-122.083851&path=color:0x0000FF80|weight:5|37.40276,-122.06360&size=220x150&sensor=false'/></a>");
businessInfo.add(Html.fromHtml(infoString, new ImageGetter(), null));
This obviously doesn't work and just shows a blue box instead of the image. As for the other images in the infoString
, I am using an ImageGetter to show those. The ImageGetter works fine but I obviously cannot use it on a static map because the URL of the map will be changing depending on the address that gets put in.
Can someone share a solution that will allow me to show the Static Map in my Textview?
链接地址: http://www.djcxy.com/p/67536.html上一篇: 努力将谷歌静态地图图像转化为应用程序