本文整理汇总了C#中IMenuItem.SetIcon方法的典型用法代码示例。如果您正苦于以下问题:C# IMenuItem.SetIcon方法的具体用法?C# IMenuItem.SetIcon怎么用?C# IMenuItem.SetIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMenuItem
的用法示例。
在下文中一共展示了IMenuItem.SetIcon方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnOptionsItemSelected
public override bool OnOptionsItemSelected (IMenuItem item) {
switch (item.ItemId) {
case Android.Resource.Id.Home:
StartActivity(new Intent(this.Activity, typeof(OrderActivity)));
break;
case Resource.Id.fav:
if (favChecked) {
item.SetIcon (Resources.GetDrawable (Resource.Drawable.fav));
favChecked = false;
} else {
item.SetIcon (Resources.GetDrawable (Resource.Drawable.favchecked));
favChecked = true;
}
break;
}
base.OnOptionsItemSelected (item);
return true;
}
示例2: OnCreateOptionsMenu
public override bool OnCreateOptionsMenu(IMenu menu){
//bool isRunning = IsTunnelServiceRunning();
base.OnCreateOptionsMenu (menu);
MenuInflater.Inflate(Resource.Layout.OptionMenu,menu);
startButton = menu.FindItem(Resource.Id.option_start_stop);
connectButton = menu.FindItem(Resource.Id.option_connect);;
exitButton = menu.FindItem(Resource.Id.option_exit);
connectButton.SetTitle("Connect To Client");
connectButton.SetIcon(Resource.Drawable.addClient);
exitButton.SetIcon(Resource.Drawable.exit);
exitButton.SetTitle("Exit");
return true;
}
示例3: OnCreateOptionsMenu
public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
{
// inflater.Inflate (Resource.Menu.mfActionBar, menu);
miAddAtt = menu.Add (1, 1, 1, @"Начать посещение");
miAddAtt.SetIcon (Resource.Drawable.ic_add_circle_outline_white_48dp);
// miAddAtt.SetShowAsAction()
miAddAtt.SetEnabled (true);
// miAddAtt.Id
miAddPhoto = menu.Add(1, 2, 2, @"Добавить фото");
miAddPhoto.SetIcon (Resource.Drawable.ic_camera_alt_white_48dp);
miAddPhoto.SetEnabled (false);
base.OnCreateOptionsMenu (menu, inflater);
}
示例4: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
mDrawerToggle.OnOptionsItemSelected (item);
if (item.ItemId == Resource.Id.action_search) {
RelativeLayout layout = FindViewById<RelativeLayout> (Resource.Id.layout_search);
if (layout.Visibility == ViewStates.Gone) {
item.SetIcon (Resource.Drawable.ic_close);
layout.Visibility = ViewStates.Visible;
layout.Alpha = 0.0f;
layout.Animate ().TranslationY (0).Alpha (1.0f);
} else {
item.SetIcon (Resource.Drawable.ic_search_white);
layout.Visibility = ViewStates.Gone;
InputMethodManager imm = (InputMethodManager)GetSystemService (Context.InputMethodService);
imm.HideSoftInputFromWindow (mSearchBox.WindowToken, 0);
}
}
return base.OnOptionsItemSelected (item);
}