本文整理汇总了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);
//.........这里部分代码省略.........