本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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();
}