コード例 #1
0
ファイル: Activity1.cs プロジェクト: kbalint/SherlockTest
 public override bool OnOptionsItemSelected(Xamarin.ActionbarSherlockBinding.Views.IMenuItem item)
 {
     switch (item.ItemId) {
     case Resource.Id.homeAsUp:
         // TODO handle clicking the app icon/logo
         return false;
     case Resource.Id.menu_refresh:
         // switch to a progress animation
         item.SetActionView(Resource.Layout.indeterminate_progress_action);
         return true;
     case Resource.Id.menu_both:
         // rotation animation of green fragment
         RotateLeftFrag();
         return true;
     case Resource.Id.menu_text:
         // alpha animation of blue fragment
         ObjectAnimator alpha = ObjectAnimator.OfFloat(rightFrag.View, "alpha", 1f, 0f);
         alpha.RepeatMode = ValueAnimatorRepeatMode.Reverse;
         alpha.RepeatCount = 1;
         alpha.SetDuration(800);
         alpha.Start();
         return true;
     case Resource.Id.menu_logo:
         useLogo = !useLogo;
         item.SetChecked(useLogo);
         base.SupportActionBar.SetDisplayUseLogoEnabled(useLogo);
         return true;
     case Resource.Id.menu_up:
         showHomeUp = !showHomeUp;
         item.SetChecked(showHomeUp);
         base.SupportActionBar.SetDisplayHomeAsUpEnabled(showHomeUp);
         return true;
     case Resource.Id.menu_nav_tabs:
         item.SetChecked(true);
         ShowTabsNav();
         return true;
     case Resource.Id.menu_nav_label:
         item.SetChecked(true);
         ShowStandardNav();
         return true;
     case Resource.Id.menu_nav_drop_down:
         item.SetChecked(true);
         ShowDropDownNav();
         return true;
     case Resource.Id.menu_bak_none:
         item.SetChecked(true);
         base.SupportActionBar.SetBackgroundDrawable(null);
         return true;
     case Resource.Id.menu_bak_gradient:
         item.SetChecked(true);
         base.SupportActionBar.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.ad_action_bar_gradient_bak));
         return true;
     default:
         return base.OnOptionsItemSelected(item);
     }
 }
コード例 #2
0
ファイル: Activity1.cs プロジェクト: kbalint/SherlockTest
            ////on selecting show progress spinner for 1s
            public bool OnMenuItemClick(Xamarin.ActionbarSherlockBinding.Views.IMenuItem item)
            {
                item.SetActionView(Resource.Layout.indeterminate_progress_action);
                Thread.Sleep(10);

                //   Handler.PostDelayed(new Java.Lang.Runnable() {
                //            public void run() {
                //                refresh.setActionView(null);
                //            }
                //        }, 1000);
                //        return false;
                return false;
            }