最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

C#開發(fā)Android百度地圖手機(jī)應(yīng)用程序(多地圖展示)

 更新時(shí)間:2016年02月04日 09:54:03   作者:rainmj  
這篇文章主要介紹了C#開發(fā)Android百度地圖手機(jī)應(yīng)用程序(多地圖展示)的相關(guān)資料,需要的朋友可以參考下

一、簡(jiǎn)介

地圖控件自v2.3.5版本起,支持多實(shí)例,即開發(fā)者可以在一個(gè)頁(yè)面中建立多個(gè)地圖對(duì)象,并且針對(duì)這些對(duì)象分別操作且不會(huì)產(chǎn)生相互干擾。

文件名:Demo04MultiMapView.cs

簡(jiǎn)介:介紹多MapView的使用

詳述:在一個(gè)界面內(nèi),同時(shí)建立四個(gè)TextureMapView控件;

二、示例

1、運(yùn)行截圖

在x86模擬器中的運(yùn)行效果如下:

在上一節(jié)例子的基礎(chǔ)上,只需要再增加下面的步驟即可。

2、添加demo05_multimap.axml文件

在layout文件夾下添加該文件,將其改為下面的代碼:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:orientation="horizontal" >
<fragment
android:id="@+id/map1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="5dp"
android:layout_weight="1"
class="com.baidu.mapapi.map.TextureMapFragment" />
<fragment
android:id="@+id/map2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
class="com.baidu.mapapi.map.TextureMapFragment" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" >
<fragment
android:id="@+id/map3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="5dp"
android:layout_weight="1"
class="com.baidu.mapapi.map.TextureMapFragment" />
<fragment
android:id="@+id/map4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
class="com.baidu.mapapi.map.TextureMapFragment" />
</LinearLayout>
</LinearLayout> 

3、添加Demo05MultiMapView.cs文件

在SdkDemos文件夾下添加該文件,然后將其內(nèi)容改為下面的代碼:

using Android.App;
using Android.Content.PM;
using Android.OS;
using Com.Baidu.Mapapi.Map;
using Com.Baidu.Mapapi.Model;
namespace BdMapV371Demos.SrcSdkDemos
{
/// <summary>
/// 在一個(gè)Activity中展示多個(gè)地圖
/// </summary>
[Activity(Label = "@string/demo_name_multimap",
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden,
ScreenOrientation = ScreenOrientation.Sensor)]
public class Demo05MutiMapView : Activity
{
private readonly LatLng Geo_BeiJing = new LatLng(39.945, 116.404);
private readonly LatLng Geo_ShangHai = new LatLng(31.227, 121.481);
private readonly LatLng Geo_GuangZhou = new LatLng(23.155, 113.264);
private readonly LatLng Geo_ShenZhen = new LatLng(22.560, 114.064);
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.demo05_multimap);
InitMap();
}
/// <summary>
/// 初始化Map
/// </summary>
private void InitMap()
{
MapStatusUpdate u1 = MapStatusUpdateFactory.NewLatLng(Geo_BeiJing);
TextureMapFragment map1 = FragmentManager.FindFragmentById<TextureMapFragment>(Resource.Id.map1);
map1.BaiduMap.SetMapStatus(u1);
MapStatusUpdate u2 = MapStatusUpdateFactory.NewLatLng(Geo_ShangHai);
TextureMapFragment map2 = FragmentManager.FindFragmentById<TextureMapFragment>(Resource.Id.map2);
map2.BaiduMap.SetMapStatus(u2);
MapStatusUpdate u3 = MapStatusUpdateFactory.NewLatLng(Geo_GuangZhou);
TextureMapFragment map3 = FragmentManager.FindFragmentById<TextureMapFragment>(Resource.Id.map3);
map3.BaiduMap.SetMapStatus(u3);
MapStatusUpdate u4 = MapStatusUpdateFactory.NewLatLng(Geo_ShenZhen);
TextureMapFragment map4 = FragmentManager.FindFragmentById<TextureMapFragment>(Resource.Id.map4);
map4.BaiduMap.SetMapStatus(u4);
}
}
}

4、修改MainActivity.cs文件

在MainActivity.cs文件的demos字段定義中添加下面的代碼。

//示例5--多地圖展示
new DemoInfo<Activity>(Resource.String.demo_title_multimap,
Resource.String.demo_desc_multimap,
new Demo05MutiMapView()), 

以上所述給大家介紹了C#開發(fā)Android百度地圖手機(jī)應(yīng)用程序(多地圖展示)的相關(guān)內(nèi)容,希望對(duì)大家有所幫助。

相關(guān)文章

  • c# Task任務(wù)的取消方式

    c# Task任務(wù)的取消方式

    文章介紹了如何在C#中使用CancellationTokenSource和CancellationToken來取消任務(wù),通過Task.Run方法和CancellationToken參數(shù),可以控制任務(wù)的執(zhí)行,并在需要時(shí)取消它們,文章還討論了CancellationToken參數(shù)的重要性
    2024-12-12
  • C#實(shí)現(xiàn)會(huì)移動(dòng)的文字效果

    C#實(shí)現(xiàn)會(huì)移動(dòng)的文字效果

    這篇文章主要為大家詳細(xì)介紹了C#實(shí)現(xiàn)會(huì)移動(dòng)的文字效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-04-04
  • C#異常捕獲機(jī)制圖文詳解

    C#異常捕獲機(jī)制圖文詳解

    在本文中我們給大家分享了關(guān)于C#異常捕獲機(jī)制的相關(guān)知識(shí)點(diǎn)內(nèi)容,有興趣的朋友們學(xué)習(xí)下。
    2019-02-02
  • C#實(shí)現(xiàn)QQ聊天窗口

    C#實(shí)現(xiàn)QQ聊天窗口

    這篇文章主要為大家詳細(xì)介紹了C#實(shí)現(xiàn)QQ聊天窗口,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-02-02
  • C#9.0:Init相關(guān)總結(jié)

    C#9.0:Init相關(guān)總結(jié)

    這篇文章主要介紹了C#9.0:Init的相關(guān)資料,幫助大家更好的理解和學(xué)習(xí)新版的c#,感興趣的朋友可以了解下
    2021-02-02
  • WPF實(shí)現(xiàn)3D粒子波浪效果

    WPF實(shí)現(xiàn)3D粒子波浪效果

    這篇文章主要為大家詳細(xì)介紹了WPF實(shí)現(xiàn)3D粒子波浪效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-09-09
  • unity實(shí)現(xiàn)玻璃效果

    unity實(shí)現(xiàn)玻璃效果

    這篇文章主要為大家詳細(xì)介紹了unity實(shí)現(xiàn)玻璃效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-04-04
  • C#中的閉包使用詳解

    C#中的閉包使用詳解

    C#中的閉包是一個(gè)強(qiáng)大的概念,它允許函數(shù)捕獲外部變量并在函數(shù)外部訪問這些變量,閉包在很多場(chǎng)景下都非常有用,比如在匿名函數(shù)、Lambda表達(dá)式和委托中,在使用閉包時(shí),我們需要注意變量捕獲的副作用、性能影響和內(nèi)存管理等問題,以確保代碼的正確性和性能
    2024-12-12
  • C#常用多線程(線程同步,事件觸發(fā),信號(hào)量,互斥鎖,共享內(nèi)存,消息隊(duì)列)

    C#常用多線程(線程同步,事件觸發(fā),信號(hào)量,互斥鎖,共享內(nèi)存,消息隊(duì)列)

    這篇文章主要介紹了C#常用多線程(線程同步,事件觸發(fā),信號(hào)量,互斥鎖,共享內(nèi)存,消息隊(duì)列),本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-09-09
  • C#中ExcelDataReader的具體使用

    C#中ExcelDataReader的具體使用

    ExcelDataReader是一個(gè)輕量級(jí)的可快速讀取Excel文件中數(shù)據(jù)的工具,本文主要介紹了C#中ExcelDataReader的具體使用,具有一定的參考價(jià)值,感興趣的可以了解一下
    2025-04-04

最新評(píng)論

福海县| 新沂市| 贵州省| 宣威市| 尼木县| 疏勒县| 新宾| 崇明县| 英山县| 固镇县| 屏南县| 巴塘县| 固始县| 福清市| 南通市| 商都县| 彭阳县| 襄城县| 葫芦岛市| 太仆寺旗| 阿鲁科尔沁旗| 图木舒克市| 沙湾县| 仙桃市| 永年县| 青神县| 朝阳市| 晋州市| 宾川县| 兴国县| 道孚县| 柳林县| 石首市| 新疆| 西峡县| 麦盖提县| 义马市| 蒲城县| 九台市| 汝州市| 赤水市|