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


C# LayoutInflater.CloneInContext方法代码示例

本文整理汇总了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;
		}
开发者ID:jeedey93,项目名称:xamarin-android-samples,代码行数:37,代码来源:DateFragment.cs


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