protected int getSelectedElement(RadioGroup aRadioGroup) { int radioButtonID = aRadioGroup.CheckedRadioButtonId; View radioButton = aRadioGroup.FindViewById(radioButtonID); if (radioButton != null) { return (int)radioButton.Tag; } else { return 0; }; }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); textSwitcher = FindViewById<TextSwitcher> (Resource.Id.text); textSwitcher.SetFactory (this); // Animation in_ = AnimationUtils.LoadAnimation (this, Android.Resource.Animation.SlideInLeft); // Animation out_ = AnimationUtils.LoadAnimation (this, Android.Resource.Animation.SlideOutRight); // textSwitcher.SetInAnimation (in_); // textSwitcher.SetOutAnimation (out_); textSwitcher.SetInAnimation (this, Android.Resource.Animation.SlideInLeft); textSwitcher.SetOutAnimation (this, Android.Resource.Animation.SlideOutRight); hTextView = FindViewById<HTextView> (Resource.Id.text2); seekBar = FindViewById<SeekBar> (Resource.Id.seekbar); seekBar.Max = 20; seekBar.ProgressChanged += (object sender, SeekBar.ProgressChangedEventArgs e) => { hTextView.SetTextSize (ComplexUnitType.Sp, 8 + e.Progress); hTextView.Reset (hTextView.Text); }; seekBar.Progress = 10; radioGroup = FindViewById<RadioGroup> (Resource.Id.typeGroup); radioGroup.CheckedChange += (object sender, RadioGroup.CheckedChangeEventArgs e) => { switch (e.CheckedId) { case Resource.Id.scale: hTextView.SetTextColor (Color.Black); hTextView.SetBackgroundColor (Color.White); hTextView.SetAnimateType (HTextViewType.Scale); break; case Resource.Id.evaporate: hTextView.SetTextColor (Color.Black); hTextView.SetBackgroundColor (Color.White); hTextView.SetAnimateType (HTextViewType.Evaporate); break; case Resource.Id.fall: hTextView.SetTextColor (Color.Black); hTextView.SetBackgroundColor (Color.White); hTextView.SetAnimateType (HTextViewType.Fall); break; case Resource.Id.pixelate: hTextView.SetTextColor (Color.Black); hTextView.SetBackgroundColor (Color.White); hTextView.SetAnimateType (HTextViewType.Pixelate); break; case Resource.Id.sparkle: hTextView.SetTextColor (Color.White); hTextView.SetBackgroundColor (Color.Black); hTextView.SetAnimateType (HTextViewType.Sparkle); break; case Resource.Id.anvil: hTextView.SetTextColor (Color.White); hTextView.SetBackgroundColor (Color.Black); hTextView.SetAnimateType (HTextViewType.Anvil); break; case Resource.Id.line: hTextView.SetTextColor (Color.White); hTextView.SetBackgroundColor (Color.Black); hTextView.SetAnimateType (HTextViewType.Line); break; case Resource.Id.typer: hTextView.SetTextColor (Color.White); hTextView.SetBackgroundColor (Color.Black); hTextView.SetAnimateType (HTextViewType.Typer); break; case Resource.Id.rainbow: hTextView.SetTextColor (Color.White); hTextView.SetBackgroundColor (Color.Black); hTextView.SetAnimateType (HTextViewType.Rainbow); break; } OnClick (radioGroup.FindViewById (e.CheckedId)); }; }