本文整理汇总了C#中Android.Views.LayoutInflater.CloneInContext方法的典型用法代码示例。如果您正苦于以下问题:C# LayoutInflater.CloneInContext方法的具体用法?C# LayoutInflater.CloneInContext怎么用?C# LayoutInflater.CloneInContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Views.LayoutInflater
的用法示例。
在下文中一共展示了LayoutInflater.CloneInContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreateView
/**
* Create and return the user interface view for this fragment.
*/
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
int theme = Arguments.GetInt("theme");
int initialYear = Arguments.GetInt("year");
int initialMonth = Arguments.GetInt("month");
int initialDay = Arguments.GetInt("day");
Date minDate = (Date) Arguments.GetSerializable("minDate");
Date maxDate = (Date) Arguments.GetSerializable("maxDate");
// Unless we inflate using a cloned inflater with a Holo theme,
// on Lollipop devices the DatePicker will be the new-style
// DatePicker, which is not what we want. So we will
// clone the inflater that we're given but with our specified
// theme, then inflate the layout with this new inflater.
Context contextThemeWrapper = new ContextThemeWrapper(Activity,theme == SlideDateTimePicker._holoDark ?Android.Resource.Style.ThemeHolo : Android.Resource.Style.ThemeHoloLight);
LayoutInflater localInflater = inflater.CloneInContext(contextThemeWrapper);
View view = localInflater.Inflate(Resource.Layout.FragmentDateLayout, container, false);
_datePicker = view.FindViewById<CustomDatePicker>(Resource.Id.datePicker);
// block keyboard popping up on touch
_datePicker.DescendantFocusability = DescendantFocusability.BlockDescendants;
_datePicker.Init (initialYear, initialMonth, initialDay, this);
if (minDate != null)
_datePicker.MinDate=minDate.Time;
if (maxDate != null)
_datePicker.MaxDate=maxDate.Time;
return view;
}