本文整理汇总了C#中Spinner.SetSelectedItem方法的典型用法代码示例。如果您正苦于以下问题:C# Spinner.SetSelectedItem方法的具体用法?C# Spinner.SetSelectedItem怎么用?C# Spinner.SetSelectedItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spinner
的用法示例。
在下文中一共展示了Spinner.SetSelectedItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var settings = Activity.GetSharedPreferences("jeegoordah.settings");
var view = inflater.Inflate(Resource.Layout.CreateTransaction, container, false);
amountInput = view.FindViewById<EditText>(Resource.Id.AmountInput);
rateInput = view.FindViewById<EditText>(Resource.Id.RateInput);
amountInBaseInput = view.FindViewById<EditText>(Resource.Id.AmountInBaseInput);
amountInput.TextChanged += (_, __) => UpdateAmountInBase();
rateInput.TextChanged += (_, __) => UpdateAmountInBase();
var eventNames = new []{ "[No Event]" }.Concat(events.OrderByDescending(e => e.GetRealStartDate()).Select(e => e.Name)).ToArray();
eventSelector = view.FindViewById<Spinner>(Resource.Id.EventSelector);
eventSelector.Adapter = new ArrayAdapter(Activity, Android.Resource.Layout.SimpleSpinnerItem, eventNames);
eventSelector.ItemSelected += (s, e) => targets = null;
var defaultEvent = Helper.GetEntityFromSettings(events, settings, "defaultEvent");
if (defaultEvent != null)
{
eventSelector.SetSelectedItem(defaultEvent.Name);
}
currencySelector = view.FindViewById<Spinner>(Resource.Id.CurrencySelector);
currencySelector.ItemSelected += (_, __) => CurrencyChanged();
currencySelector.Adapter = new ArrayAdapter(Activity, Android.Resource.Layout.SimpleSpinnerItem,
currencies.OrderBy(c => c.Name).Select(c => c.Name).ToArray());
var defaultCurrency = Helper.GetEntityFromSettings(currencies, settings, "defaultCurrency");
if (defaultCurrency != null)
{
currencySelector.SetSelectedItem(defaultCurrency.Name);
}
sourceSelector = view.FindViewById<Spinner>(Resource.Id.SourceSelector);
sourceSelector.Adapter = new ArrayAdapter(Activity, Android.Resource.Layout.SimpleSpinnerItem,
bros.OrderBy(b => b.Name).Select(b => b.Name).ToArray());
view.FindViewById<Button>(Resource.Id.TargetsButton).Click += (s, e) =>
{
if (targets == null)
{
CreateDefaultTargets();
}
DialogFragment newFragment = new BroMultiSelector(targets, newTargets => targets = newTargets);
newFragment.Show(FragmentManager, "");
};
view.FindViewById<Button>(Resource.Id.CreateTransaction).Click += (s, e) => CreateTransaction();
return view;
}