当前位置: 首页>>代码示例>>C#>>正文


C# ImageButton.SetImageResource方法代码示例

本文整理汇总了C#中ImageButton.SetImageResource方法的典型用法代码示例。如果您正苦于以下问题:C# ImageButton.SetImageResource方法的具体用法?C# ImageButton.SetImageResource怎么用?C# ImageButton.SetImageResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImageButton的用法示例。


在下文中一共展示了ImageButton.SetImageResource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnCreate

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			// Get our button from the layout resource,
			// and attach an event to it
			btnLight = FindViewById<ImageButton>(Resource.Id.imageButton);
			btnLight.SetImageResource(Resource.Drawable.iTorchOff);

			Android.Content.PM.PackageManager pm = PackageManager;

			hasFlash = pm.HasSystemFeature(Android.Content.PM.PackageManager.FeatureCameraFlash);
			if (!hasFlash) {

				//set alert for executing the task
				AlertDialog.Builder alert = new AlertDialog.Builder (this);

				alert.SetTitle ("Error");
				alert.SetMessage ("Sorry, your device doesn't support flash light");
				alert.SetPositiveButton ("OK", (senderAlert, args) => {
					Finish ();
				} );
				//run the alert in UI thread to display in the screen
				RunOnUiThread (() => {
					alert.Show();
				} );

			}

			btnLight.Click += delegate {
				if (isFlashOn) {
					// turn off flash
					TurnOffFlash();
					int h = btnLight.Height;
					btnLight.SetImageResource(Resource.Drawable.iTorchOff);
					//ShapeDrawable mDrawable = new ShapeDrawable(new OvalShape());
					///mDrawable.Paint.SetShader(new LinearGradient(0, 0, 0, h, Color.Red, Color.Red, Shader.TileMode.Repeat));
					//btnLight.SetBackgroundDrawable (mDrawable);
					//btnLight.Text="Tap to off the flash";
				} else {
					// turn on flash
					TurnOnFlash();
					btnLight.SetImageResource(Resource.Drawable.iTourchOn);
					int h = btnLight.Height;
					ShapeDrawable mDrawable = new ShapeDrawable(new OvalShape());
					mDrawable.Paint.SetShader(new LinearGradient(0, 0, 0, h, Color.Green, Color.Red, Shader.TileMode.Repeat));
					//btnLight.SetBackgroundDrawable (mDrawable);
					//btnLight.Text="Tap to on the flash";
				}
				//btnLight.Text = string.Format ("{0} clicks!", count++);
			};		
		}
开发者ID:RamBachkheti,项目名称:Xamarin-Samples,代码行数:55,代码来源:MainActivity.cs

示例2: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.InspectEvent, container, false);

            titleTextView = view.FindViewById<TextView>(Resource.Id.titleTextView);
            timeTextView = view.FindViewById<TextView>(Resource.Id.timeTextView);
            distanceTextView = view.FindViewById<TextView>(Resource.Id.distanceTextView);
            descriptionTextView = view.FindViewById<TextView>(Resource.Id.descriptionTextView);
            currentUsersEventButton = view.FindViewById<Button>(Resource.Id.current_users_event_btn);
            eventCreatorIconImageView = view.FindViewById<RoundedImageView>(Resource.Id.eventCreatorIcon);

            topLeftToolbarButton = Activity.FindViewById<Button>(Resource.Id.topToolbarButtonLeft);
            topRightToolbarButton = Activity.FindViewById<Button>(Resource.Id.topToolbarButtonRight);
            topLeftToolbarImageButton = Activity.FindViewById<ImageButton>(Resource.Id.topToolbarImageButtonLeft);
            topRightToolbarImageButton = Activity.FindViewById<ImageButton>(Resource.Id.topToolbarImageButtonRight);

            topLeftToolbarImageButton.SetImageResource(Resource.Drawable.ic_chevron_left);
            topLeftToolbarButton.Visibility = ViewStates.Gone;
            topLeftToolbarImageButton.Visibility = ViewStates.Visible;
            topRightToolbarButton.Visibility = ViewStates.Gone;
            topRightToolbarImageButton.Visibility = ViewStates.Gone;

            titleTextView.Text = chosenEvent.Title;
            timeTextView.Text = chosenEvent.Time;
            distanceTextView.Text = chosenEvent.Position;
            descriptionTextView.Text = chosenEvent.Description;
            currentUsersEventButton.Text = chosenEvent.CurrentUsers + "/" + chosenEvent.TotalUsers;
            currentUsersEventButton.Click += CurrentUsersEventButton_Click;
            eventCreatorIconImageView.Click += EventCreatorIconImageView_Click;

            return view;
        }
开发者ID:wijen1,项目名称:HowlOut,代码行数:32,代码来源:InspectEvent.cs

示例3: OnCreate

		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			// Set our view from the "main" layout resource
			//SetContentView (Resource.Layout.Main);

			var context = new MasterMainCategoryRepository ();			

			var layout = new LinearLayout(this)
			{
				Orientation = Orientation.Vertical,
				LayoutParameters =
					new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
			};
					
			List<MasterMainCategory> mmcs = context.GetMasterMainCategories ();

			foreach (var mmc in mmcs) {
				ImageButton ib = new ImageButton (this);

				int resID = Resources.GetIdentifier(mmc.imgsrc.ToLower(), "drawable", PackageName);
				ib.SetImageResource(resID);

				ib.Click += delegate {
					var act = new Intent (this, typeof(SubCatActivity));
					act.PutExtra ("mainCat", mmc.name);
					StartActivity (act);
				};

				layout.AddView(ib);
			}

			SetContentView (layout);


//			ImageButton btnHouse = FindViewById<ImageButton>(Resource.Id.btnHouse);
//			ImageButton btnPeople = FindViewById<ImageButton>(Resource.Id.btnPeople);
//			ImageButton btnMisc = FindViewById<ImageButton>(Resource.Id.btnMisc);
//			btnHouse.Click += delegate {
//				var act = new Intent (this, typeof(SubCatActivity));
//				act.PutExtra ("mainCat", "House");
//				StartActivity (act);
//			};
//			btnPeople.Click += delegate {
//				var act = new Intent (this, typeof(SubCatActivity));
//				act.PutExtra ("mainCat", "People");
//				StartActivity (act);
//			};
//			btnMisc.Click += delegate {
//				var act = new Intent (this, typeof(SubCatActivity));
//				act.PutExtra ("mainCat", "Miscellaneous");
//				StartActivity (act);
//			};

		}
开发者ID:sesurb,项目名称:InfoStash,代码行数:56,代码来源:MainActivity.cs

示例4: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.InspectJoinedUsers, container, false);

            topLeftToolbarButton = Activity.FindViewById<Button>(Resource.Id.topToolbarButtonLeft);
            topRightToolbarButton = Activity.FindViewById<Button>(Resource.Id.topToolbarButtonRight);
            topLeftToolbarImageButton = Activity.FindViewById<ImageButton>(Resource.Id.topToolbarImageButtonLeft);
            topRightToolbarImageButton = Activity.FindViewById<ImageButton>(Resource.Id.topToolbarImageButtonRight);

            topLeftToolbarImageButton.SetImageResource(Resource.Drawable.ic_chevron_left);
            topLeftToolbarButton.Visibility = ViewStates.Gone;
            topLeftToolbarImageButton.Visibility = ViewStates.Visible;
            topRightToolbarButton.Visibility = ViewStates.Gone;
            topRightToolbarImageButton.Visibility = ViewStates.Gone;

            return view;
        }
开发者ID:wijen1,项目名称:HowlOut,代码行数:17,代码来源:InspectJoinedUsers.cs

示例5: InitView

		public void InitView(List<BookingDocumentDto> _bookingDocs) {
			this.RemoveAllViews ();
			int size = _bookingDocs.Count;
			for(int i = 0; i < size; i ++) {
				LinearLayout ll = new LinearLayout (_context);
				ll.Orientation = Orientation.Horizontal;
				ll.SetVerticalGravity (GravityFlags.CenterVertical);

				ImageView imgFile = new ImageView (_context);
				imgFile.SetImageResource (Resource.Drawable.ic_attach);

				var tvFileAttach = new TextView (_context) {
					Text = _bookingDocs[i].OriginalFileName
				};
				tvFileAttach.Id = i;
				tvFileAttach.SetTextColor (Color.Blue);
				tvFileAttach.PaintFlags = PaintFlags.UnderlineText;
				tvFileAttach.SetTypeface (null, TypefaceStyle.Bold);
				tvFileAttach.SetSingleLine (true);
				tvFileAttach.Ellipsize = global::Android.Text.TextUtils.TruncateAt.Middle;
				tvFileAttach.SetPadding (5, 0, 10, 0);
				LayoutParams param = new TableRow.LayoutParams(0, LayoutParams.WrapContent, 1f);
				tvFileAttach.LayoutParameters = param;
				tvFileAttach.Click += (sender, e) => {
					utilsAndroid.onViewFile(_context, _bookingDocs[tvFileAttach.Id].S3FileName);
				};

				ImageButton imgDelete = new ImageButton (_context);
				imgDelete.Id = i;
				imgDelete.SetImageResource (Resource.Drawable.ic_delete);
				imgDelete.SetMinimumWidth (50);
				imgDelete.SetMinimumHeight (50);
				imgDelete.SetBackgroundColor (Color.Transparent);
				imgDelete.Click += (sender, e) => {
					_deleteFile.onDeleteFile(_isInConference, _bookingDocs[imgDelete.Id]);
				};

				ll.AddView (imgFile);
				ll.AddView (tvFileAttach);
				ll.AddView (imgDelete);
				ll.SetPadding (0, 5, 0, 5);

				this.AddView (ll);
			}
		}
开发者ID:borain89vn,项目名称:demo2,代码行数:45,代码来源:OnAddFileToView.cs

示例6: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.SearchEvents, container, false);

            topLeftToolbarButton = Activity.FindViewById<Button>(Resource.Id.topToolbarButtonLeft);
            topRightToolbarButton = Activity.FindViewById<Button>(Resource.Id.topToolbarButtonRight);
            topLeftToolbarImageButton = Activity.FindViewById<ImageButton>(Resource.Id.topToolbarImageButtonLeft);
            topRightToolbarImageButton = Activity.FindViewById<ImageButton>(Resource.Id.topToolbarImageButtonRight);

            topLeftToolbarButton.Text = "Tracked";
            topRightToolbarImageButton.SetImageResource(Resource.Drawable.ic_action_settings);
            topLeftToolbarButton.Visibility = ViewStates.Visible;
            topLeftToolbarImageButton.Visibility = ViewStates.Gone;
            topRightToolbarButton.Visibility = ViewStates.Gone;
            topRightToolbarImageButton.Visibility = ViewStates.Visible;

            return view;
        }
开发者ID:wijen1,项目名称:HowlOut,代码行数:18,代码来源:SearchEvents.cs

示例7: Initialize

		void Initialize ()
		{
			DefaultTranslation = 208.ToPixels ();
			var inflater = Context.GetSystemService (Context.LayoutInflaterService).JavaCast<LayoutInflater> ();
			inflater.Inflate (Resource.Layout.ArtistItemLayout, this, true);
			artistImage = FindViewById<ImageView> (Resource.Id.ArtistBgImage);
			artistName = FindViewById<TextView> (Resource.Id.artistName);
			questionButton = FindViewById<ImageButton> (Resource.Id.questionBtn);
			libraryHeader = FindViewById<TextView> (Resource.Id.libraryHeaderText);
			drawer = FindViewById<FrameLayout> (Resource.Id.ArtistDrawer);
			artistImageLoading = FindViewById<ProgressBar> (Resource.Id.artistImageLoading);
			artistScore = FindViewById<TextView> (Resource.Id.ArtistScore);

			questionButton.SetImageResource (Resource.Drawable.question_btn);
			questionButton.Click += (s, e) => Opened = !Opened;

			similarArtistList = FindViewById<ListView> (Resource.Id.similarArtistsList);
			similarArtistAdapter = new ArrayAdapter (Context, Resource.Layout.SimilarArtistItem);
			similarArtistList.Adapter = similarArtistAdapter;
		}
开发者ID:phaufe,项目名称:Similardio,代码行数:20,代码来源:ArtistItemView.cs

示例8: GetSampleContent

        public override Android.Views.View GetSampleContent(Context context)
        {
            sfGrid = new SfDataGrid(context);
            viewModel = new ExportingViewModel();
            sfGrid.AutoGeneratingColumn += GridGenerateColumns;
            sfGrid.ItemsSource = (viewModel.OrdersInfo);
            exportPdf = new ImageButton(context);
            exportPdf.SetMaxHeight(30);
            exportPdf.SetMaxWidth(30);
            exportPdf.SetBackgroundColor(Android.Graphics.Color.Transparent); 
            exportPdf.SetImageResource(Resource.Drawable.pdfexport);
            exportPdf.SetScaleType(ImageView.ScaleType.FitXy);
            exportPdf.LayoutParameters = new ViewGroup.LayoutParams( 120,120);
            exportPdf.Click += ExportToPdf;
            exportExcel = new ImageButton(context);
            exportExcel.SetMaxHeight(30);
            exportExcel.SetMaxWidth(30);
            exportExcel.SetBackgroundColor(Android.Graphics.Color.Transparent);
            exportExcel.SetImageResource(Resource.Drawable.excelexport);
            exportExcel.SetScaleType(ImageView.ScaleType.FitXy);
            exportExcel.LayoutParameters = new ViewGroup.LayoutParams(120, 120);
            exportExcel.Click += ExportToExcel;

            LinearLayout option = new LinearLayout(context);
            option.SetGravity(GravityFlags.Center);
            option.Orientation = Android.Widget.Orientation.Horizontal;
            var pdftext = new TextView(context) { Text = "Export to Pdf" };
            pdftext.SetTypeface(null, TypefaceStyle.Bold);
            var exceltext = new TextView(context) { Text = "Export to Excel" };
            exceltext.SetTypeface(null, TypefaceStyle.Bold);
            option.AddView(exportPdf);         
            option.AddView(pdftext);
            option.AddView(exportExcel);
            option.AddView(exceltext);
            
            LinearLayout mainView = new LinearLayout(context);
            mainView.Orientation = Android.Widget.Orientation.Vertical;
            mainView.AddView(option);
            mainView.AddView(sfGrid);
            return mainView;
        }
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:41,代码来源:Exporting.cs

示例9: Initialize

        private void Initialize()
        {
            try
            {
                _redColor = Resources.GetColor(Resource.Color.task_progress_red);
                _greenColor = Resources.GetColor(Resource.Color.task_progress_green);

                _playerName = FindViewById<TextView>(Resource.Id.playerInGameName);
                _playerPosition = FindViewById<TextView>(Resource.Id.playerInGamePostion);
                _playerScore = FindViewById<TextView>(Resource.Id.playerInGameScore);
                _makeThisButton = FindViewById<Button>(Resource.Id.makeThisButton);
                _refuseButton = FindViewById<Button>(Resource.Id.refuseButton);
                _cardImage = FindViewById<ImageButton>(Resource.Id.taskImageButton);
                _actionButton = (TextView)CreateActionButton(Resource.Drawable.table_button);
                _points = FindViewById<TextView>(Resource.Id.points);
                _x2 = FindViewById<TextView>(Resource.Id.x2);
                _coninueButton = FindViewById<ImageButton>(Resource.Id.continueButton);
                _scoreTextView = FindViewById<TextView>(Resource.Id.scoreString);

                _taskEnumerator = Rep.DatabaseHelper.Tasks.Enumerator;
                _playerEnumerator = Rep.Instance.Players.Enumerator;

                _playerName.SetTypeface(Rep.FontManager.Get(Font.Bold), TypefaceStyle.Normal);
                _playerPosition.SetTypeface(Rep.FontManager.Get(Font.Regular), TypefaceStyle.Normal);
                _makeThisButton.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed), TypefaceStyle.Normal);
                _refuseButton.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed), TypefaceStyle.Normal);
                _playerScore.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed), TypefaceStyle.Normal);
                _points.SetTypeface(Rep.FontManager.Get(Font.Bold), TypefaceStyle.Normal);
                _x2.SetTypeface(Rep.FontManager.Get(Font.Bold), TypefaceStyle.Normal);
                _cardImage.SetImageResource(Resource.Drawable.card_backside); ;
                _scoreTextView.SetTypeface(Rep.FontManager.Get(Font.Condensed), TypefaceStyle.Normal);

                _taskProgressView = FindViewById<RelativeLayout>(Resource.Id.taskProgressView);
            }
            catch (Exception exception)
            {
                GaService.TrackAppException(this.Class, "Initialize", exception, true);
            }
        }
开发者ID:okrotowa,项目名称:Mosigra.Yorsh,代码行数:39,代码来源:GameActivity.cs

示例10: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Post);
            postsViewModel = new PostsViewModel(new PlayerAdapter());
            ServiceLocator.Dispatcher = new DispatchAdapter(this);
            list = FindViewById<ListView>(Resource.Id.list);
            adapter = new PostAdapter(this, postsViewModel.posts);
            actionBar = SupportActionBar;
            setActionBarIdle();
            list.ItemClick += new EventHandler<AdapterView.ItemClickEventArgs>(list_ItemClick);
            footerNextPosts = LayoutInflater.Inflate(Resource.Layout.NextPostFooter, list, false);
            footerNextPosts.Click += (o, e) =>
            {
                loadFuturePosts();
            };
            footerRefresh = LayoutInflater.Inflate(Resource.Layout.RefreshFooter, list, false);
            footerRefresh.Click += (o, e) =>
            {
                loadFuturePosts();
            };
            headerPreviousPosts = LayoutInflater.Inflate(Resource.Layout.PreviousPostsHeader, list, false);
            headerPreviousPosts.Click += (o, e) =>
            {
                loadPreviousPosts();
            };
            FindViewById<TextView>(Resource.Id.forum_title).Text = postsViewModel.selectedDiscussion.name;
            FindViewById<TextView>(Resource.Id.forum_range).Text = HttpUtils.discussionDateToShowFormat(postsViewModel.selectedDiscussion.startDate) + " - "
                + HttpUtils.discussionDateToShowFormat(postsViewModel.selectedDiscussion.endDate);
            toggleHeader();
            toggleFooter();
            list.Adapter = adapter;
            play = FindViewById<ImageButton>(Resource.Id.button_play);

            play.Click += (o, e) => 
            {
                postsViewModel.playSelectedPost();
            };

            stop = FindViewById<ImageButton>(Resource.Id.button_stop);

            stop.Click += (o, e) =>
            {
                play.SetImageResource(Resource.Drawable.playback_play);
                togglePlayerBar(false);
                postsViewModel.releaseResources();
                postsViewModel.removeSelection();
            };

            next = FindViewById<ImageButton>(Resource.Id.button_next);

            next.Click += (o, e) =>
            {
                play.SetImageResource(Resource.Drawable.playback_pause);
                postsViewModel.playNextInSelection();
            };

            prev = FindViewById<ImageButton>(Resource.Id.button_prev);

            prev.Click += (o, e) =>
            {
                play.SetImageResource(Resource.Drawable.playback_pause);
                postsViewModel.playPreviousInSelection();
            };

            ServiceLocator.Messenger.Subscribe<BaseViewMessage>(m =>
            {
                switch (m.Content.message) 
                {
                    case BaseViewMessage.MessageTypes.NO_NEW_POSTS:
                    Toast.MakeText(this, "Não há novos posts", ToastLength.Short).Show();
                    break;
                    case BaseViewMessage.MessageTypes.FUTURE_POSTS_LOADED:
                    toggleFooter();
                    break;
                    case BaseViewMessage.MessageTypes.PREVIOUS_POSTS_LOADED:
                    toggleHeader();
                    break;
                    case BaseViewMessage.MessageTypes.FINISHED_PLAYING:
                    togglePlayerBar(false);
                    break;
                    case BaseViewMessage.MessageTypes.UPDATE_SCREEN:
                    updateScreen();
                    break;
                    default:
                    break;
                }            
            });
        }
开发者ID:paulombcosta,项目名称:mono-mobilis,代码行数:89,代码来源:PostActivity.cs

示例11: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.TotemDetail);

            //if else that prevents crash when app is killed
            if (_appController.CurrentTotem == null) {
                var i = new Intent(this, typeof(MainActivity));
                StartActivity(i);
                Finish();
            } else {
                //Action bar
                InitializeActionBar(SupportActionBar);
                title = ActionBarTitle;
                back = ActionBarBack;
                search = ActionBarSearch;

                //single toast for entire activity
                mToast = Toast.MakeText(this, "", ToastLength.Short);

                number = FindViewById<TextView>(Resource.Id.number);
                title_synonyms = FindViewById<TextView>(Resource.Id.title_synonyms);
                body = FindViewById<TextView>(Resource.Id.body);

                _gestureDetector = new GestureDetector(this);

                title.Text = "Beschrijving";

                if (!_appController.ShowAdd) {
                    action = ActionBarDelete;
                    action.Click += (sender, e) => RemoveFromProfile(_appController.CurrentProfiel.name);
                } else {
                    action = ActionBarAdd;
                    action.Click += (sender, e) => ProfilePopup();
                }
                action.Visibility = ViewStates.Visible;

                search.Visibility = ViewStates.Visible;
                search.SetImageResource(Resource.Drawable.ic_visibility_off_white_24dp);
                search.Click += (sender, e) => ToggleHidden();

                _appController.NavigationController.GotoProfileListEvent += StartProfielenActivity;

                SetInfo();
            }
        }
开发者ID:FrederickEskens,项目名称:Totem,代码行数:47,代码来源:TotemDetailActivity.cs

示例12: setImage

 /// <summary>
 ///     Setting a button with her image view.
 /// </summary>
 /// <param name="btn"></param>
 /// <param name="shape"></param>
 private void setImage(ImageButton btn,string shape)
 {
     int drawbleid = Resources.GetIdentifier(shape , "drawable", this.PackageName);
     btn.SetImageResource(drawbleid);
 }
开发者ID:iDesireJustice,项目名称:Leonardo,代码行数:10,代码来源:Game.cs

示例13: initiateButtonsArray

        /// <summary>
        ///     Initiating the 2 dimentional array of buttons with a blank image.
        /// </summary>
        private void initiateButtonsArray(){
            try{
                // Allocate the array of cards, which contains the properties.
                buttonsArray = new Card[SIZE, SIZE];
                // Instantiate with white properties.
                for (int i = 0; i < SIZE; i++){
                    for (int j = 0; j < SIZE; j++){
                       buttonsArray[i, j] = new Card( "blank", "white", 0); 
                    }
                }
                
                // Initialize the button 
                outerImage = new Card("blank", "white", 0);
                outerButton = FindViewById<ImageButton>(Resource.Id.outerImgBtn);
                outerButton.SetImageResource(Resource.Drawable.blank);
               
                // Allocate the two dimensional array of image buttons.
                gameImgButtons = new ImageButton[SIZE, SIZE];

                //  Initialize Image buttons array.
                for (int i = 0; i < SIZE; i++){
                    for (int j = 0; j < SIZE; j++){
                        gameImgButtons[i, j] = new ImageButton(this);
                    }
                }

                // Set all images with the blank image.
                for (int i = 0; i < SIZE; i++){
                    for (int j = 0; j < SIZE; j++){
                        gameImgButtons[i, j].SetImageResource(Resource.Drawable.blank);
                    }
                }
            }
            catch (Exception){
                showMessage("Something went wrong in game initialization");
            }
            
    }
开发者ID:iDesireJustice,项目名称:Leonardo,代码行数:41,代码来源:Game.cs

示例14: OnCreateView

		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			mapView = base.OnCreateView (inflater, container, savedInstanceState);

			// Save ScreenController for later use
			ctrl = ((GameController)this.Activity);

			RelativeLayout view = new RelativeLayout(ctrl);
			view.AddView(mapView, new RelativeLayout.LayoutParams(-1, -1));

//			var view = inflater.Inflate(Resource.Layout.ScreenMap, container, false);
//
//			mapView = new MapView(ctrl);
//			mapView.OnCreate(savedInstanceState);
//
			// Set all relevant data for map

			_zoom = (float)Main.Prefs.GetDouble("MapZoom", 16);

			_map = this.Map;
			_map.MapType = GoogleMap.MapTypeNormal;
			_map.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(Main.GPS.Location.Latitude, Main.GPS.Location.Longitude), _zoom));
			_map.MyLocationEnabled = true;
			_map.BuildingsEnabled = true;
			_map.UiSettings.ZoomControlsEnabled = false;
			_map.UiSettings.MyLocationButtonEnabled = false;
			_map.UiSettings.CompassEnabled = false;
			_map.UiSettings.TiltGesturesEnabled = false;
			_map.UiSettings.RotateGesturesEnabled = false;
			_map.MapClick += OnMapClick;

			// Create tile layers
			_osmTileLayer = new OsmTileProvider("http://a.tile.openstreetmap.org/{0}/{1}/{2}.png");
			_ocmTileLayer = new OsmTileProvider("http://c.tile.opencyclemap.org/cycle/{0}/{1}/{2}.png");

			// Set selected map type
			SetMapType(Main.Prefs.GetInt("map_source", 0));

			// Create the zones the first time
			CreateZones();

			// Create layout for map buttons
			layoutButtons = new RelativeLayout(ctrl);

			// Button for center menu
			var lp = new RelativeLayout.LayoutParams(64, 64);
			lp.SetMargins(16, 16, 16, 8);
			lp.AddRule(LayoutRules.AlignParentLeft);
			lp.AddRule(LayoutRules.AlignParentTop);

			btnMapCenter = new ImageButton(ctrl);
			btnMapCenter.Id = 1;
			btnMapCenter.SetImageResource(Resource.Drawable.ic_button_center);
			btnMapCenter.SetBackgroundResource(Resource.Drawable.MapButton);
			btnMapCenter.Click += OnMapCenterButtonClick;

			layoutButtons.AddView(btnMapCenter, lp);

			// Button for the orientation: north up or always in direction
			lp = new RelativeLayout.LayoutParams(64, 64);
			lp.SetMargins(16, 8, 16, 16);
			lp.AddRule(LayoutRules.Below, btnMapCenter.Id);
			lp.AddRule(LayoutRules.AlignParentLeft);

			btnMapOrientation = new ImageButton(ctrl);
			if (Main.Prefs.GetBool ("MapOrientationNorth", true))
				btnMapOrientation.SetImageResource (Resource.Drawable.ic_button_orientation_north);
			else
				btnMapOrientation.SetImageResource (Resource.Drawable.ic_button_orientation);
			btnMapOrientation.SetBackgroundResource(Resource.Drawable.MapButton);
			btnMapOrientation.Click += OnMapOrientationButtonClick;

			layoutButtons.AddView(btnMapOrientation, lp);

			// Button for selecting the map type
			lp = new RelativeLayout.LayoutParams(64, 64);
			lp.SetMargins(16, 16, 16, 8);
			lp.AddRule(LayoutRules.AlignParentTop);
			lp.AddRule(LayoutRules.AlignParentRight);

			btnMapType = new ImageButton(ctrl);
			btnMapType.SetImageResource(Resource.Drawable.ic_button_layer);
			btnMapType.SetBackgroundResource(Resource.Drawable.MapButton);
			btnMapType.Click += OnMapTypeButtonClick;

			layoutButtons.AddView(btnMapType, lp);

			view.AddView(layoutButtons);

			return view;
		}
开发者ID:WFoundation,项目名称:WF.Player.Android,代码行数:91,代码来源:GameMapScreen.cs

示例15: OnCreateView

		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			View view = inflater.Inflate(Resource.Layout.PopularActivity, container, false);


			Scope = "Local";
			Type = "Timed";

			TopTimedGlobalPostFeedFragment = new PostFeedFragment();
			TopTimedGlobalPostFeedFragment.EmptyTableString = Strings.no_active_posts;
			TopTimedGlobalPostFeedFragment.Master = this;
			TopTimedGlobalPostFeedFragment.Target = FeedTypeEnum.FeedType.PopularGlobalTimedFeed;
			TopTimedGlobalPostFeedFragment.NewPageContainerID = Resource.Id.fragment_container_page;

			TopTimedLocalFeedFragment = new PostFeedFragment();
			TopTimedLocalFeedFragment.EmptyTableString = Strings.no_active_posts;
			TopTimedLocalFeedFragment.Master = this;
			TopTimedLocalFeedFragment.Target = FeedTypeEnum.FeedType.PopularLocalTimedFeed;
			TopTimedLocalFeedFragment.NewPageContainerID = Resource.Id.fragment_container_page;

			TopTimersGlobalUserFeedFragment = new UserFeedFragment();
			TopTimersGlobalUserFeedFragment.EmptyTableString = Strings.no_users_found;
			TopTimersGlobalUserFeedFragment.Master = this;
			TopTimersGlobalUserFeedFragment.Target = FeedTypeEnum.FeedType.PopularGlobalTimersFeed;

			TopTimersLocalUserFeedFragment = new UserFeedFragment();
			TopTimersLocalUserFeedFragment.EmptyTableString = Strings.no_users_found;
			TopTimersLocalUserFeedFragment.Master = this;
			TopTimersLocalUserFeedFragment.Target = FeedTypeEnum.FeedType.PopularLocalTimersFeed;

			View toolbarLayout = view.FindViewById(Resource.Id.toolbarLayout);
			((TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_titleCenter)).Text = "Popular";


			timersButton = (Button)view.FindViewById(Resource.Id.timers);
			timersButton.Click += delegate
			{
				timedButton.SetBackgroundResource(Resource.Drawable.LeftSegmentedControl);
				timedButton.SetTextColor(Android.Graphics.Color.ParseColor("#338a9e"));
				timersButton.SetBackgroundResource(Resource.Drawable.RightSegmentedControlSelected);
				timersButton.SetTextColor(Android.Graphics.Color.White);
				Type = "Timers";
				ShowCorrectPage();
			};

			timedButton = (Button)view.FindViewById(Resource.Id.timed);
			timedButton.Click += delegate
			{
				timedButton.SetBackgroundResource(Resource.Drawable.LeftSegmentedControlSelected);
				timedButton.SetTextColor(Android.Graphics.Color.White);
				timersButton.SetBackgroundResource(Resource.Drawable.RightSegmentedControl);
				timersButton.SetTextColor(Android.Graphics.Color.ParseColor("#338a9e"));
				Type = "Timed";
				ShowCorrectPage();
			};


			localButton = (ImageButton)view.FindViewById(Resource.Id.local);
			localButton.Click += delegate
			{
				localButton.SetImageResource(Resource.Drawable.localselected);
				globalButton.SetImageResource(Resource.Drawable.global);
				Scope = "Local";
				ShowCorrectPage();
			};

			globalButton = (ImageButton)view.FindViewById(Resource.Id.global);
			globalButton.Click += delegate
			{
				localButton.SetImageResource(Resource.Drawable.local);
				globalButton.SetImageResource(Resource.Drawable.globalselected);
				Scope = "Global";
				ShowCorrectPage();
			};

			timedButton.CallOnClick();
			localButton.CallOnClick();

			return view;

		}
开发者ID:natevarghese,项目名称:XamarinTen,代码行数:81,代码来源:PopularFragment.cs


注:本文中的ImageButton.SetImageResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。