Because the Baidu map api,2.0+ and 3.0+ changes relatively big, API basically was completely changed, some students may 2.0+ API use is very familiar with, but update to 3.0+, but will encounter some small trouble (because the API has changed, you need to re-learn its API, the code will be re-written , which is more painful than egg). So here are some small examples, I hope to upgrade to the 3.0+ of the students have some help.
1. How does the Baidu map API map move to the specified latitude and longitude? As shown in the code
Private voidChoosemylocation (DoubleLaDoublelo) { //turn on the positioning functionBaidumap.setmylocationenabled (true); //Constructing positioning DataMylocationdata Locationdata =NewMylocationdata.builder (). Latitude (LA). Longitude (LO). Build (); //Setting location dataBaidumap.setmylocationdata (Locationdata); //Customize to chartBitmapdescriptor marker =bitmapdescriptorfactory. Fromresource (R.drawable.trip_icon_mark_address_point); //set the configuration of the anchor layer, set the icon to follow the status (icon is always in the center of the map)mylocationconfiguration config =Newmylocationconfiguration (locationmode.following,true, marker); Baidumap.setmylocationconfigeration (config); //turn off the anchor layer when no positioning is required//baidumap.setmylocationenabled (false); }
Of course there is no animation effect, the need for students can add their own animation effect (when changing the status of the map to execute)
Android 3.0+ Baidu Map API Map How to move to a specified latitude and longitude