コード例 #1
0
		void CreateMap ()
		{
			_myMapFrag = SupportMapFragment.NewInstance();
			//FragmentTransaction tx = FragmentManager.BeginTransaction();

			var tx = ChildFragmentManager.BeginTransaction ();
			tx.Add(Resource.Id.frameMap, _myMapFrag);
			tx.Commit();
		}
コード例 #2
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// add map fragment to frame layout
			var mapFragment = new SupportMapFragment ();
			var fragmentTx = this.SupportFragmentManager.BeginTransaction ();
			fragmentTx.Add (Resource.Id.linearLayout1, mapFragment);
			fragmentTx.Commit ();

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);
		}
コード例 #3
0
		async Task AddMap ()
		{
			var fragment = new SupportMapFragment ();

			// Insert the fragment by replacing any existing fragment
			SupportFragmentManager.BeginTransaction ()
				.Replace (Resource.Id.content_frame, fragment)
				.Commit ();

			//get a reference to the GoogleMap object
			_map = await new GetMapHelper ().GetMap (fragment);

			//show the zoom controls 
			_map.UiSettings.ZoomControlsEnabled = true;
		}
コード例 #4
0
		public override Android.Views.View OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState)
		{
			if (container == null)
				return null;

			var view =  inflater.Inflate (Resource.Layout.frag_map, null);

			_myMapFrag = SupportMapFragment.NewInstance ();
			FragmentTransaction fragTrans = ChildFragmentManager.BeginTransaction ();
			fragTrans.Add (Resource.Id.map, _myMapFrag);
			fragTrans.Commit ();

			return view;

		}
コード例 #5
0
		private void InitMapFragment()
		{
			_mapFragment = SupportFragmentManager.FindFragmentByTag("map") as SupportMapFragment;
			if (_mapFragment == null)
			{
				GoogleMapOptions mapOptions = new GoogleMapOptions()
					.InvokeMapType(GoogleMap.MapTypeSatellite)
						.InvokeZoomControlsEnabled(false)
						.InvokeCompassEnabled(true);

				FragmentTransaction fragTx = SupportFragmentManager.BeginTransaction();
				_mapFragment = SupportMapFragment.NewInstance(mapOptions);
				fragTx.Add(Resource.Id.map, _mapFragment, "map");
				fragTx.Commit();
			}
		}
コード例 #6
0
		void ListItemClicked (int position)
		{
			SupportFragmentManager.PopBackStack (null, (int)PopBackStackFlags.Inclusive);

			Android.Support.V4.App.Fragment fragment = null;

			switch (position) 
			{
			case 0:
				//load a map fragment directly from the API
				fragment = new SupportMapFragment ();

				break;
			case 1:
				//load a fragment with a frame layout, create a SupportMapFragment,
				//and insert it into the frame layout
				fragment = new MyMapFragment ();
				break;
			case 2:
				//load a fragment with a map fragment defined in the layout
				fragment = new MyMapFragment2 ();
				break;
			case 3:
				//example of map in a fragment sharing screen space with other controls
				fragment = new MyMapFragment3 ();
				break;
			default:

				break;
			}

			// Insert the fragment by replacing any existing fragment
			SupportFragmentManager.BeginTransaction ()
				.Replace (Resource.Id.content_frame, fragment)
				.Commit ();

			// Highlight the selected item, update the title, and close the drawer
			drawerList.SetItemChecked (position, true);
			SupportActionBar.Title = sections [position];
			drawerLayout.CloseDrawer (drawerList);
		}
コード例 #7
0
ファイル: LocationDialog.cs プロジェクト: wijen1/HowlOut
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(Resource.Layout.LocationDialog, container, false);

            //SetUpMap();

            mapFragment =
                (SupportMapFragment)Activity.SupportFragmentManager.FindFragmentById(Resource.Id.selectLocationMap);
            mapFragment.GetMapAsync(this);

            returnButton = view.FindViewById<Button>(Resource.Id.locationReturnBtn);
            confirmButton = view.FindViewById<Button>(Resource.Id.locationConfirmBtn);

            confirmButton.Click += ConfirmButton_Click;

            returnButton.Click += ReturnButton_Click;

            return view;
        }
コード例 #8
0
        bool SetUpGoogleMap(SupportMapFragment mapFrag)
        {
            if (null != map) return false;

            var mapReadyCallback = new OnMapReadyClass();

            mapReadyCallback.MapReadyAction += delegate (GoogleMap googleMap)
            {
                map = googleMap;
                if (MapReady != null)
                    this.MapReady(this, new EventArgs());
            };

            mapFrag.GetMapAsync(mapReadyCallback);
            return true;
        }
コード例 #9
-1
			public async Task<GoogleMap> GetMap (SupportMapFragment frag)
			{
				//check to see if the task is running
				if (tcs != null && tcs.Task.Status == TaskStatus.Running) {
					return await tcs.Task;
				}

				//instantiate the task
				tcs = new TaskCompletionSource<GoogleMap> ();

				//get the GoogleMap object
				frag.GetMapAsync (this);
				await tcs.Task;

				return tcs.Task.Result;
			}