About Baidu Map Infowindow response custom Layout Click events

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.