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


C# Xamarin.Add方法代码示例

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


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

示例1: OnCreateOptionsMenu

		public override bool OnCreateOptionsMenu (Xamarin.ActionbarSherlockBinding.Views.IMenu menu)
		{
			//Used to put dark icons on light action bar
			bool isLight = SampleList.THEME == Resource.Style.Theme_Sherlock_Light;

			menu.Add ("Save")
				.SetIcon (isLight ? Resource.Drawable.ic_compose_inverse : Resource.Drawable.ic_compose)
					.SetShowAsAction (MenuItem.ShowAsActionIfRoom);

			menu.Add ("Search")
				.SetShowAsAction (MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionWithText);

			menu.Add ("Refresh")
				.SetIcon (isLight ? Resource.Drawable.ic_refresh_inverse : Resource.Drawable.ic_refresh)
					.SetShowAsAction (MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionWithText);

			return true;
		}
开发者ID:adbk,项目名称:spikes,代码行数:18,代码来源:ContextMenus.cs

示例2: OnCreateOptionsMenu

		public override bool OnCreateOptionsMenu (Xamarin.ActionbarSherlockBinding.Views.IMenu menu)
		{
			for (int i = 0; i < items; i++) {
				menu.Add ("Text")
					.SetIcon (Resource.Drawable.ic_title_share_default)
						.SetShowAsAction (MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionWithText);
			}

			return base.OnCreateOptionsMenu (menu);
		}
开发者ID:adbk,项目名称:spikes,代码行数:10,代码来源:FeatureToggles.cs

示例3: OnCreateOptionsMenu

		public override bool OnCreateOptionsMenu (Xamarin.ActionbarSherlockBinding.Views.IMenu menu)
		{
			//Used to put dark icons on light action bar
			bool isLight = SampleList.THEME == Resource.Style.Theme_Sherlock_Light;

			menu.Add ("Search")
				.SetIcon (isLight ? Resource.Drawable.ic_search_inverse : Resource.Drawable.ic_search)
					.SetActionView (Resource.Layout.collapsible_edittext)
					.SetShowAsAction (MenuItem.ShowAsActionAlways | MenuItem.ShowAsActionCollapseActionView);

			return true;
		}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:12,代码来源:CollapsibleActionItem.cs

示例4: OnCreateOptionsMenu

        public override bool OnCreateOptionsMenu(Xamarin.ActionbarSherlockBinding.Views.IMenu menu)
        {
            // Skapar en sökvy
            var searchView = new SearchView(SupportActionBar.ThemedContext)
            {
                QueryHint = "Search artist..."
            };
            searchView.SetOnQueryTextListener(this);

            menu.Add(1, 1, 1, "Search")
                .SetActionView(searchView)
                .SetIcon(Android.Resource.Drawable.abs__ic_search)
                .SetShowAsAction(MenuItem.ShowAsActionAlways | MenuItem.ShowAsActionCollapseActionView);
            var searchItemActionBar = menu.FindItem(1);

            searchView.QueryTextSubmit += async (sender, e) =>
            {
                searchItemActionBar.CollapseActionView();
                SetSupportProgressBarIndeterminateVisibility(true);
                searchView.ClearFocus();
                try
                {
                    var artistName = await _repository.FindArtistAsync(e.Query);
                    var artist = await _repository.SearchArtistAsync(artistName);
                    var topTracks = await _repository.GetTopTracksAsync(artist.Name);
                    var topAlbums = await _repository.GetTopAlbumsAsync(artist.Name);

                    // Serialisera objektet och skicka det till artistactivity...
                    var jsonArtist = JsonConvert.SerializeObject(artist);
                    var jsonTopTracks = JsonConvert.SerializeObject(topTracks.Take(15));
                    var jsonTopAlbums = JsonConvert.SerializeObject(topAlbums.Take(5));

                    var artistActivity = new Intent(this, typeof(ArtistActivity));

                    artistActivity.PutExtra("Artist", jsonArtist);
                    artistActivity.PutExtra("TopTracks", jsonTopTracks);
                    artistActivity.PutExtra("TopAlbums", jsonTopAlbums);

                    SetSupportProgressBarIndeterminateVisibility(false);
                    StartActivity(artistActivity);
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, "Error: " + ex.Message, ToastLength.Short).Show();
                    SetSupportProgressBarIndeterminateVisibility(false);
                }
            };
            return true;
        }
开发者ID:jonteho,项目名称:last.fm-appcrossplat,代码行数:49,代码来源:StartFragmentActivity.cs

示例5: OnCreateOptionsMenu

        public override bool OnCreateOptionsMenu(Xamarin.ActionbarSherlockBinding.Views.IMenu menu)
        {
            if (ThisApp.ReaderKind != ReaderKind.WOLReader)
            {
                var previousMenu = menu.Add(0, PREVIOUS_MENU, PREVIOUS_MENU, "Previous");
                previousMenu.SetShowAsAction(1);
                previousMenu.SetIcon(Android.Resource.Drawable.IcMediaRew);

                var nextMenu = menu.Add(0, NEXT_MENU, NEXT_MENU, "Next");
                nextMenu.SetShowAsAction(1);
                nextMenu.SetIcon(Android.Resource.Drawable.IcMediaFf);
            }

            if (ThisApp.ReaderKind == ReaderKind.BibleReader)
            {
                var noteMenu = menu.Add(0, NOTE_MENU, NOTE_MENU, "Note");
                noteMenu.SetShowAsAction(1);
                noteMenu.SetIcon(Android.Resource.Drawable.IcMenuAdd);
            }

            if (ThisApp.ReaderKind == ReaderKind.DailyTextReader)
            {
                var todayMenu = menu.Add(0, TODAY_MENU, TODAY_MENU, "Today");
                todayMenu.SetShowAsAction(1);
                todayMenu.SetIcon(Android.Resource.Drawable.IcMenuToday);
            }

            if (ThisApp.ReaderKind == ReaderKind.PublicationReader)
            {
                //var highlightMenu = menu.Add(0, HIGHLIGHT_MENU, HIGHLIGHT_MENU, "Highlighter");
                //highlightMenu.SetShowAsAction(1);
            }

            if (ThisApp.ReaderKind == ReaderKind.WOLReader)
            {
                var saveMenu = menu.Add(0, SAVE_MENU, SAVE_MENU, "Save");
                saveMenu.SetShowAsAction(1);
                saveMenu.SetIcon(Android.Resource.Drawable.IcMenuSave);
            }

            var translateMenu = menu.Add(0, TRANSLATE_MENU, TRANSLATE_MENU, "Translate");
            translateMenu.SetShowAsAction(1);
            translateMenu.SetIcon(Android.Resource.Drawable.IcMenuRotate);

            var gotoMenu = menu.Add(0, GOTO_MENU, GOTO_MENU, "Look Up");
            gotoMenu.SetShowAsAction(1);
            gotoMenu.SetIcon(Android.Resource.Drawable.IcMenuUpload);

            return base.OnCreateOptionsMenu(menu);
        }
开发者ID:GuyMicciche,项目名称:SuperNWTBible,代码行数:50,代码来源:ReaderActivity.cs


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