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


C# Activity.GetActionBar方法代码示例

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


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

示例1: OnAttached

        public void OnAttached(Activity activity)
        {
            var actionBar = activity.GetActionBar();
            if (actionBar == null)
            {
                Tracer.Error("Cannot apply ActionBarView the ActionBar is null, activity {0}", activity.GetType().FullName);
                return;
            }

            var activityView = activity as IActivityView;
            if (activityView != null)
                activityView.Mediator.Destroyed += DestroyedHandler;

            if (_resourceId != int.MinValue)
            {
                if (_tabContentId != int.MinValue)
                    ServiceProvider.AttachedValueProvider.SetValue(actionBar, TabContentIdKey, _tabContentId);
                using (XmlReader reader = Context.Resources.GetLayout(_resourceId))
                {
                    //NOTE XDocument throws an error.
                    var document = new XmlDocument();
                    document.Load(reader);
                    using (var stringReader = new StringReader(PlatformExtensions.XmlTagsToUpper(document.InnerXml)))
                    {
                        var barTemplate = (ActionBarTemplate)Serializer.Deserialize(stringReader);
                        barTemplate.Apply(activity);
                    }
                }
            }

            if (_bindings == null)
                return;
            for (int i = 0; i < _bindings.Count; i++)
                BindingServiceProvider.BindingProvider.CreateBindingsFromString(actionBar, _bindings[i], null);
            this.RemoveFromParent();
            this.ClearBindingsRecursively(true, true);
        }
开发者ID:sami1971,项目名称:MugenMvvmToolkit,代码行数:37,代码来源:ActionBarView.cs

示例2: Clear

 public static void Clear(Activity activity)
 {
     var actionBar = activity.GetActionBar(false);
     if (actionBar == null)
         return;
     for (int i = 0; i < actionBar.TabCount; i++)
         ActionBarTabTemplate.ClearTab(actionBar, actionBar.GetTabAt(i), false);
     actionBar.ClearBindings(true, true);
 }
开发者ID:MuffPotter,项目名称:MugenMvvmToolkit,代码行数:9,代码来源:ActionBarTemplate.cs

示例3: ActivityViewOnSaveInstanceState

 private static void ActivityViewOnSaveInstanceState(Activity sender, ValueEventArgs<Bundle> args)
 {
     var actionBar = sender.GetActionBar();
     if (actionBar == null)
         return;
     var index = actionBar.SelectedNavigationIndex;
     args.Value.PutInt(SelectedTabIndexKey, index);
 }
开发者ID:MuffPotter,项目名称:MugenMvvmToolkit,代码行数:8,代码来源:ActionBarTemplate.cs

示例4: Apply

        public void Apply(Activity activity)
        {
            PlatformExtensions.ValidateTemplate(ItemsSource, Tabs);
            var actionBar = activity.GetActionBar();

            var setter = new XmlPropertySetter<ActionBarTemplate, ActionBar>(actionBar, activity, new BindingSet());
            setter.SetEnumProperty<ActionBarNavigationMode>(() => template => template.NavigationMode, NavigationMode);
            setter.SetProperty(() => template => template.DataContext, DataContext);

            if (!string.IsNullOrEmpty(Bind))
                setter.BindingSet.BindFromExpression(actionBar, Bind);
            setter.SetProperty(() => template => template.ContextActionBarTemplate, ContextActionBarTemplate);
            setter.SetBinding(() => template => template.ContextActionBarVisible, ContextActionBarVisible, false);
            setter.SetProperty(() => template => template.BackgroundDrawable, BackgroundDrawable);
            setter.SetProperty(() => template => template.CustomView, CustomView);
            setter.SetEnumProperty<ActionBarDisplayOptions>(() => template => template.DisplayOptions, DisplayOptions);
            setter.SetBoolProperty(() => template => template.DisplayHomeAsUpEnabled, DisplayHomeAsUpEnabled);
            setter.SetBoolProperty(() => template => template.DisplayShowCustomEnabled, DisplayShowCustomEnabled);
            setter.SetBoolProperty(() => template => template.DisplayShowHomeEnabled, DisplayShowHomeEnabled);
            setter.SetBoolProperty(() => template => template.DisplayShowTitleEnabled, DisplayShowTitleEnabled);
            setter.SetBoolProperty(() => template => template.DisplayUseLogoEnabled, DisplayUseLogoEnabled);
            setter.SetBoolProperty(() => template => template.HomeButtonEnabled, HomeButtonEnabled);
            setter.SetProperty(() => template => template.Icon, Icon);
            setter.SetProperty(() => template => template.Logo, Logo);
            setter.SetProperty(() => template => template.SplitBackgroundDrawable, SplitBackgroundDrawable);
            setter.SetProperty(() => template => template.StackedBackgroundDrawable, StackedBackgroundDrawable);
            setter.SetBoolProperty(() => template => template.IsShowing, IsShowing);
            setter.SetStringProperty(() => template => template.Subtitle, Subtitle);
            setter.SetStringProperty(() => template => template.Title, Title);
            setter.SetBoolProperty(() => template => template.Visible, Visible);
            setter.SetBinding("HomeButton.Click", HomeButtonClick, false);

            if (string.IsNullOrEmpty(ItemsSource))
            {
                if (Tabs != null)
                {
                    ActionBar.Tab firstTab = null;
                    for (int index = 0; index < Tabs.Count; index++)
                    {
                        var tab = Tabs[index].CreateTab(actionBar);
                        if (firstTab == null)
                            firstTab = tab;
                        actionBar.AddTab(tab);
                    }
                    TryRestoreSelectedIndex(activity, actionBar);
                }
            }
            else
            {
#if APPCOMPAT
                actionBar.SetBindingMemberValue(AttachedMembersCompat.ActionBar.ItemsSourceGenerator, new ActionBarTabItemsSourceGenerator(actionBar, TabTemplate));
#else
                actionBar.SetBindingMemberValue(AttachedMembers.ActionBar.ItemsSourceGenerator, new ActionBarTabItemsSourceGenerator(actionBar, TabTemplate));
#endif
                setter.SetBinding(() => template => template.ItemsSource, ItemsSource, false);
            }
            setter.SetBinding(() => template => template.SelectedItem, SelectedItem, false);
            setter.Apply();
        }
开发者ID:MuffPotter,项目名称:MugenMvvmToolkit,代码行数:59,代码来源:ActionBarTemplate.cs


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