Category: C#, Android, VS2015, Baidu map application; Creation date: 2016-02-04 3.3 Example 3--Use of MapFragment 1. Introduction TextureMapFragment: used to display map fragments. 2. Example 3--Demo03MapFragment.cs File name: Demo02MapFragment.cs Introduction: Introducing the use of maps under the Fragment framework Details
Category: C#, Android, VS2015, Baidu map application; Creation date: 2016-02-04
3.3 Example 3--Usage of MapFragment
1. Introduction
TextureMapFragment: used to display map fragments.
2. Example 3--Demo03MapFragment.cs
File name: Demo02MapFragment.cs
Introduction: Introducing the use of maps under the Fragment framework
Details: Introduce how to add a TextureMapFragment control under the Fragment framework;
1. Running screenshots
The effect of running in x86 simulator is as follows:
2. Design steps
Based on the example in the previous section, you only need to add the following steps.
(1) Modify layout file
Rename demo02_fragment.xml to demo02_fragment.xml. The purpose of this is to facilitate the observation of the layout file corresponding to the example.
(2) Add Demo03MapFragment.cs
Add this file under SrcSdkDemos.
<span style="color: #0000ff;">using</span><span style="color: #000000;"> Android.App; </span><span style="color: #0000ff;">using</span><span style="color: #000000;"> Android.OS; </span><span style="color: #0000ff;">using</span><span style="color: #000000;"> Android.Content.PM; </span><span style="color: #0000ff;">using</span><span style="color: #000000;"> Com.Baidu.Mapapi.Map; </span><span style="color: #0000ff;">namespace</span><span style="color: #000000;"> BdMapV371Demos.SrcSdkDemos { [Activity(Label </span>= <span style="color: #800000;">"</span><span style="color: #800000;">@string/demo_name_map_fragment</span><span style="color: #800000;">"</span><span style="color: #000000;">, ConfigurationChanges </span>= ConfigChanges.Orientation |<span style="color: #000000;"> ConfigChanges.KeyboardHidden, ScreenOrientation </span>=<span style="color: #000000;"> ScreenOrientation.Sensor)] </span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span><span style="color: #000000;"> Demo03MapFragment : Activity { </span><span style="color: #0000ff;">PRivate</span><span style="color: #000000;"> TextureMapFragment map; </span><span style="color: #0000ff;">protected</span> <span style="color: #0000ff;">override</span> <span style="color: #0000ff;">void</span><span style="color: #000000;"> OnCreate(Bundle savedInstanceState) { </span><span style="color: #0000ff;">base</span><span style="color: #000000;">.OnCreate(savedInstanceState); SetContentView(Resource.Layout.demo03_fragment); MapStatus ms </span>= <span style="color: #0000ff;">new</span><span style="color: #000000;"> MapStatus.Builder() .Target(MainActivity.HeNanUniversity) .Overlook(</span><span style="color: #800080;">20</span><span style="color: #000000;">) .Zoom(</span><span style="color: #800080;">15</span><span style="color: #000000;">) .Build(); BaiduMapOptions bo </span>= <span style="color: #0000ff;">new</span><span style="color: #000000;"> BaiduMapOptions() .MapStatus(ms) .CompassEnabled(</span><span style="color: #0000ff;">false</span><span style="color: #000000;">) .ZoomControlsEnabled(</span><span style="color: #0000ff;">true</span><span style="color: #000000;">); map </span>=<span style="color: #000000;">TextureMapFragment.NewInstance(bo); FragmentManager.BeginTransaction().Add(Resource.Id.map, map, </span><span style="color: #800000;">"</span><span style="color: #800000;">map_fragment</span><span style="color: #800000;">"</span><span style="color: #000000;">).Commit(); } } }</span>
(3) Modify MainActivity.cs
Add the following code in the demos field definition of the MainActivity.cs file.
<span style="color: #008000;"> //</span><span style="color: #008000;">示例3--MapFragment使用</span> <span style="color: #0000ff;">new</span> DemoInfo<activity><span style="color: #000000;">(Resource.String.demo_title_map_fragment, Resource.String.demo_desc_map_fragment, </span><span style="color: #0000ff;">new</span> Demo03MapFragment()),</activity>
Run and observe the results.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver CS6
Visual web development tools
