Android Baidu Map Application of the basic map function to achieve _android

Source: Internet
Author: User

First, Introduction
1, map
Map Show: General maps (2D,3D), satellite maps and real-time traffic maps.
Map operation: Through the interface or gesture control to achieve the map of the click, double-click, Long Press, scaling, translation, rotation, change the angle of view and other operations.
2. Map type
Baidu Map Android SDK 3.6.1 provides two types of map resources (general vector map and satellite map, set the way to see DEMO04), if you do not specify the map type, the default is normal vector map.
This example only demonstrates the basic usage of common vector graphs.
3, this sample feature description
This example shows how to build a basic map page, and shows how to display a custom longitude and latitude coordinates as the center point of the Baidu map.
Introduction: Create a Baidu map and manage the life cycle of the map.
Detailed:
(1) To create a single most simple Baidu map;
(2) Manage the life cycle of the map, please refer to the Code section of the relevant comments;
(3) Can monitor the map loading to complete the event;
4. This example runs the screenshot
The effect of running in the x86 emulator is as follows:

Second, design steps
1. Add Demo02BaseMap.cs File
First add a Srcsdkdemos folder to your project, and then add the file under that folder.

Using Android.app;
Using Android.Content.PM;
Using Android.os;

Using Com.Baidu.Mapapi.Map; namespace Bdmapv371demos.srcsdkdemos {[Activity (Label = "@string/demo_name_basemap", configurationchanges = CONFIGC Hanges. Orientation |
  Configchanges.keyboardhidden, screenorientation = screenorientation.sensor)] public class demo02basemap:activity

    {Private Texturemapview Mmapview; protected override void OnCreate (Bundle savedinstancestate) {base.
      OnCreate (savedinstancestate); Mmapview = new Texturemapview (This, new Baidumapoptions (). Mapstatus (New Mapstatus.builder (). Target (mainactivity.henanuniversity).
      Build ()));
    Setcontentview (Mmapview); } protected override void OnPause () {base.
      OnPause ();
    Mmapview.onpause (); } protected override void Onresume () {base.
      Onresume ();
    Mmapview.onresume (); } protected override void OnDestroy () {base.
      OnDestroy (); MmApview.ondestroy (); 
 }
  }
}

2. Modify MainActivity.cs File
Add the following code to the Demos field definition of the MainActivity.cs file.

private static readonly demoinfo<activity>[] Demos =
    {
      ...
      Example 1--basic map features
      new demoinfo<activity> (Resource.String.demo_title_basemap,
        Resource.String.demo_ Desc_basemap,
        new Demo01basemap ()),
    } 

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.