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


C# Spinner.SetGravity方法代码示例

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


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

示例1: GetPropertyWindowLayout

		public override View GetPropertyWindowLayout (Context context)
		{
			int width = (context.Resources.DisplayMetrics.WidthPixels) / 2;
			propertylayout = new LinearLayout(context);
			propertylayout.Orientation = Orientation.Vertical;

			LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
				width * 2, 3);

			layoutParams.SetMargins(0, 20, 0, 0);

			TextView culture = new TextView(context);
			culture.TextSize=20;
			culture.Text="Position";

			positionSpinner = new Spinner(context);
			positionSpinner.SetGravity(GravityFlags.Left);


			List<String> list = new List<String>();

			list.Add("Left");
			list.Add("Right");
			list.Add("Top");
			list.Add("Bottom");


			dataAdapter = new ArrayAdapter<String>
				(context, Android.Resource.Layout.SimpleSpinnerItem, list);
			dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);


			positionSpinner.Adapter = dataAdapter;
			positionSpinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
				String selectedItem= dataAdapter.GetItem(e.Position);
				if (selectedItem.Equals("Left")) {
					sliderposition = Position.Left;
				}
				if (selectedItem.Equals("Right")) {
					sliderposition = Position.Right;
				}
				if (selectedItem.Equals("Top")) {
					sliderposition = Position.Top;
				}
				if (selectedItem.Equals("Bottom")) {
					sliderposition = Position.Bottom;
				}
			};

			propertylayout.AddView(culture);
			propertylayout.AddView(positionSpinner);

			SeparatorView separate = new SeparatorView(context, width * 2);
			separate.separatorColor = Color.LightGray;
			separate.LayoutParameters=new ViewGroup.LayoutParams(width * 2, 3);
			propertylayout.AddView(separate, layoutParams);

			TextView culture2 = new TextView(context);
			culture2.TextSize=20;
			culture2.Text="Animations";

			animationSpinner = new Spinner(context);

			animationSpinner.SetGravity(GravityFlags.Left);


			List<String> list2 = new List<String>();

			list2.Add("SlideOnTop");
			list2.Add("Reveal");
			list2.Add("Push");



			dataAdapter1 = new ArrayAdapter<String>
				(context, Android.Resource.Layout.SimpleSpinnerItem, list2);

			dataAdapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);;

			animationSpinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
				String selectedItem= dataAdapter1.GetItem(e.Position);
				if (selectedItem.Equals("SlideOnTop")) {
					sliderTransition = Transition.SlideOnTop;
				}
				if (selectedItem.Equals("Reveal")) {
					sliderTransition =Transition.Reveal;
				}
				if (selectedItem.Equals("Push")) {
					sliderTransition =Transition.Push;
				}
			};

			animationSpinner.Adapter = dataAdapter1;
			propertylayout.AddView(culture2);
			propertylayout.AddView(animationSpinner);

			SeparatorView separate2 = new SeparatorView(context, width * 2);
			separate2.separatorColor = Color.LightGray;
			separate2.LayoutParameters=new ViewGroup.LayoutParams(width * 2, 3);
			propertylayout.AddView(separate2, layoutParams);
//.........这里部分代码省略.........
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:101,代码来源:NavigationDrawer.cs


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