Approximate explanation:
A marker is displayed on the Baidu map, and when marker is clicked, a custom view is displayed. When a custom view is clicked, it responds to the Click event of a different button. Is Baidu this infowindo inside of view pit miserable, always thought can't click?? The original view can be clicked or can be responded to!!
Look first:
Note: Click Details (enter this task details, click the navigation to enter Baidu Navigation)
The code is as follows:
Baidumap.setonmarkerclicklistener (New Baidumap.onmarkerclicklistener () { @Override public Boolean Onmarkerclick (Marker Marker) { latlng latlng =marker.getposition (); Infowindow Currentinfowindow = new Infowindow (Getinfowindoview (Marker,taskjson), LATLNG, -77); Baidumap.showinfowindow (Currentinfowindow); return true; } });
So where is the custom view of Infowindow?
Private View Getinfowindoview (final Marker marker,final jsonobject Taskjson) {if (null = = InfoView) { InfoView = (viewgroup) layoutinflater.from (assignmentsactivity). Inflate (r.layout.balloon_overlay, NULL); } Tvtitle = (TextView) Infoview.findviewbyid (r.id.balloon_item_title); Tvdetaillocation = (TextView) Infoview.findviewbyid (R.id.balloon_item_snippet); Layout_taskinfo = (linearlayout) Infoview.findviewbyid (r.id.layout_taskinfo); Iv_navigation = (ImageView) Infoview.findviewbyid (r.id.iv_navigation); Tvtitle.settext (Marker.getextrainfo (). getString ("title")); Tvdetaillocation.settext (Marker.getextrainfo (). getString ("subject")); Layout_taskinfo.setonclicklistener (New View.onclicklistener () {@Override public void OnClick (View V ) {Common.switchtotaskdetail (assignmentsactivity, Taskjson); } }); Iv_navigation.setonclicklistener (New View.onclicklistener ({@Override public void OnClick (View v) {Viewinmapapp (Marker.getposition (). Latitud E, Marker.getposition (). longitude); } }); return InfoView; }
Infowindow must do this at initialization time to respond to individual click events.
Infowindow Currentinfowindow = new Infowindow (Getinfowindoview (Marker,taskjson), LATLNG,-77);
Technorati Tags: baidu map, Android Baidu
About Baidu Map Infowindow response custom Layout Click events