I am using android google maps api v2 with many markers displayed on it. Each time you click on a marker a custom info window with specific tittle/snippet is open. The problem is that I cannot click on the URL "www.news.com". Please find below the options of my marker. How can I specify that the "www.news.com" is a HTML URL link inside the .snippet attribute, and when user clicking on it to open directly in mobiles explorer?
mMap.addMarker(new MarkerOptions()
.position(new LatLng(39.686286, 19.838443))
.title("HELLO")
.snippet("Name: \nSurname: \nphone: XXX \nwebsite: www.news.com")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.location_icon)));
From the documentation (my emphasis):
As mentioned in the previous section on info windows, an info window is not a live View, rather the view is rendered as an image onto the map. As a result, any listeners you set on the view are disregarded and you cannot distinguish between click events on various parts of the view. You are advised not to place interactive components — such as buttons, checkboxes, or text inputs — within your custom info window.
The url cannot be clicked separately from the info window as a whole. You may consider assigning a click listener to the info window itself, and navigating to the appropriate webpage whenever the info window is clicked.
来源:https://stackoverflow.com/questions/29300500/open-url-from-custom-info-window-android-google-maps-v2