mMapView = FindViewById<TextureMapView>(Resource.Id.bmapView); mBaiduMap = mMapView.Map; //设置底图显示模式:普通地图 mBaiduMap.MapType = BaiduMap.MapTypeNormal; //设置底图显示模式:卫星地图 mBaiduMap.MapType = BaiduMap.MapTypeSatellite;
mMapView = FindViewById<TextureMapView>(Resource.Id.bmapView); mBaiduMap = mMapView.Map; //开启交通图 mBaiduMap.TrafficEnabled = true;
mMapView = FindViewById<TextureMapView>(Resource.Id.bmapView); mBaiduMap = mMapView.Map; //开启交通图 mBaiduMap.BaiduHeatMapEnabled = true;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioGroup
android:id="@+id/RadioGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/normal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:checked="true"
android:text="普通图" />
<RadioButton
android:id="@+id/statellite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="卫星图" />
</RadioGroup>
<CheckBox
android:id="@+id/traffice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:checked="false"
android:text="交通图" />
<CheckBox
android:id="@+id/baiduHeatMap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:checked="false"
android:text="百度城市热力图" />
</LinearLayout>
<com.baidu.mapapi.map.TextureMapView
android:id="@+id/bmapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true" />
</LinearLayout>
using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Widget;
using Com.Baidu.Mapapi.Map;
namespace BdMapV371Demos.SrcSdkDemos
{
/// <summary>
/// 演示地图图层显示的控制方法
/// </summary>
[Activity(Label = "@string/demo_name_layers",
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden,
ScreenOrientation = ScreenOrientation.Sensor)]
public class Demo04Layers : Activity
{
//TextureMapView 是地图主控件
private TextureMapView mMapView;
private BaiduMap mBaiduMap;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.demo04_layers);
mMapView = FindViewById<TextureMapView>(Resource.Id.bmapView);
mBaiduMap = mMapView.Map;
mBaiduMap.SetMapStatus(MapStatusUpdateFactory.NewLatLng(MainActivity.HeNanUniversity));
//设置底图显示模式:普通图
var normal = FindViewById<RadioButton>(Resource.Id.normal);
normal.Click += delegate
{
mBaiduMap.MapType = BaiduMap.MapTypeNormal;
};
//设置底图显示模式:卫星图
var statellite = FindViewById<RadioButton>(Resource.Id.statellite);
statellite.Click += delegate
{
mBaiduMap.MapType = BaiduMap.MapTypeSatellite;
};
//是否显示交通图
var traffice = FindViewById<CheckBox>(Resource.Id.traffice);
traffice.CheckedChange += (s, e) =>
{
mBaiduMap.TrafficEnabled = e.IsChecked;
};
//是否显示热力图
var baiduHeatMap = FindViewById<CheckBox>(Resource.Id.baiduHeatMap);
traffice.CheckedChange += (s, e) =>
{
mBaiduMap.BaiduHeatMapEnabled = e.IsChecked;
};
}
protected override void OnPause()
{
mMapView.OnPause();
base.OnPause();
}
protected override void OnResume()
{
mMapView.OnResume();
base.OnResume();
}
protected override void OnDestroy()
{
mMapView.OnDestroy();
base.OnDestroy();
}
}
}
//示例4--图层展示
new DemoInfo<Activity>(Resource.String.demo_title_layers,
Resource.String.demo_desc_layers,
new Demo04Layers()),
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有