本文整理汇总了C#中Android.App.Activity.GetBindableLayoutInflater方法的典型用法代码示例。如果您正苦于以下问题:C# Activity.GetBindableLayoutInflater方法的具体用法?C# Activity.GetBindableLayoutInflater怎么用?C# Activity.GetBindableLayoutInflater使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.App.Activity
的用法示例。
在下文中一共展示了Activity.GetBindableLayoutInflater方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetContent
private void SetContent(ActionBar.Tab tab, FragmentTransaction ft, int? placeHolder, Activity activity, ActionBar bar)
{
if (placeHolder == null)
{
Tracer.Error("The placeholder for tab {0} was not found.", tab);
return;
}
var layout = activity.FindViewById<ViewGroup>(placeHolder.Value);
if (layout == null)
{
Tracer.Warn("The ActionBarTabContentId with id = {0} is not found in activity {1}",
placeHolder.Value,
activity);
return;
}
if (_content == null)
{
#if APPCOMPAT
_content = tab.GetBindingMemberValue(AttachedMembersCompat.ActionBarTab.Content);
#else
_content = tab.GetBindingMemberValue(AttachedMembers.ActionBarTab.Content);
#endif
var viewModel = _content as IViewModel;
if (viewModel == null)
{
var fragmentClass = _content as string;
//If content is a string, trying to create a fragment.
if (!string.IsNullOrEmpty(fragmentClass))
{
var type = TypeCache<Fragment>.Instance.GetTypeByName(fragmentClass, true, false);
if (type != null)
{
var fragment = Fragment.Instantiate(bar.ThemedContext, Java.Lang.Class.FromType(type).Name);
_content = fragment;
}
}
else if (_content is int)
_content = activity.GetBindableLayoutInflater().Inflate((int)_content, null);
}
else
viewModel.Settings.Metadata.AddOrUpdate(ViewModelConstants.StateNotNeeded, true);
_content = PlatformExtensions.GetContentView(layout, layout.Context, _content,
_contentTemplateProvider.GetTemplateId(), _contentTemplateProvider.GetDataTemplateSelector());
layout.SetContentView(_content, ft, (@group, fragment, arg3) =>
{
if (fragment.IsDetached)
arg3.Attach(fragment);
else
arg3.Replace(@group.Id, fragment);
});
}
else
layout.SetContentView(_content, ft, (@group, fragment, arg3) => arg3.Attach(fragment));
}