本文整理汇总了C#中Android.Widget.SeekBar.SetOnSeekBarChangeListener方法的典型用法代码示例。如果您正苦于以下问题:C# SeekBar.SetOnSeekBarChangeListener方法的具体用法?C# SeekBar.SetOnSeekBarChangeListener怎么用?C# SeekBar.SetOnSeekBarChangeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Widget.SeekBar
的用法示例。
在下文中一共展示了SeekBar.SetOnSeekBarChangeListener方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Options);
weightInput = FindViewById<EditText>(Resource.Id.weightInput);
stepSizeInput = FindViewById<EditText>(Resource.Id.stepSizeInput);
sensivityInput = FindViewById<SeekBar>(Resource.Id.sensivityInput);
sensivityOutput = FindViewById<TextView>(Resource.Id.sensivityOutput);
sensivityInput.SetOnSeekBarChangeListener(this);
weightInput.Text = MainActivity.weight.ToString();
stepSizeInput.Text = MainActivity.stepLength.ToString();
sensivityInput.Progress = sensivityInput.Max - MainActivity.mLimit;
}
示例2: OnBindDialogView
protected override void OnBindDialogView(View view)
{
base.OnBindDialogView(view);
if (ShouldPersist())
_progress = GetPersistedInt(_defaultValue + _minimumValue) - _minimumValue;
_valueText = view.FindViewById<TextView>(Resource.Id.Label);
_seekBar = view.FindViewById<SeekBar>(Resource.Id.SeekBar);
_seekBar.SetOnSeekBarChangeListener(this);
_seekBar.Max = _maximumValue;
_seekBar.Progress = _progress;
updateText();
}
示例3: OnCreate
//use a scrollview: http://stackoverflow.com/questions/4055537/how-do-you-make-a-linearlayout-scrollable
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
// Create your application here
SetContentView (Resource.Layout.MoodAssessment);
//select random background picture
//find view with background
LinearLayout LayoutMood = FindViewById<LinearLayout>(Resource.Id.LinearLayoutMood);
rnd = new Random(); //generator is seeded each time it is initialized
switch (rnd.Next (7)) {
case 0:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.clouds_low));
break;
case 1:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.beach_gauss));
break;
case 2:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.dawn_low));
break;
case 3:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.flower_pink_low));
break;
case 4:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.flower_red_low));
break;
case 5:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.forest_low));
break;
case 6:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.sea_low));
break;
}
//CHOOSE QUESTIONS TO ASK
int alreadyAsked = 0; //default value: no questions have been asked yet since this is an example
int posQuestion = ChoosePositiveQuestion (alreadyAsked);
int negQuestion = ChooseNegativeQuestion (alreadyAsked);
//update alreadyAsked with the newly chosen questions, only write to db after the save button has been pressed
alreadyAsked += (int)Math.Pow(2,posQuestion) + (int)Math.Pow(2,negQuestion+5);
//Toast.MakeText(this, "New Asked: " + alreadyAsked.ToString(), ToastLength.Short).Show();
//Provide the chosen questions with seekbars and smileys. Make sure to pick good smileys for the negative affect questions
//CODE FOR POSITIVE AND NEGATIVE SEEKBAR QUESTIONS
TextView posAffectText = FindViewById<TextView>(Resource.Id.textViewPosAffect);
TextView negAffectText = FindViewById<TextView>(Resource.Id.textViewNegAffect);
switch (posQuestion) {
case 0:
posAffectText.Text = GetString(Resource.String.PosAffect1);
break;
case 1:
posAffectText.Text = GetString(Resource.String.PosAffect2);
break;
case 2:
posAffectText.Text = GetString(Resource.String.PosAffect3);
break;
case 3:
posAffectText.Text = GetString(Resource.String.PosAffect4);
break;
case 4:
posAffectText.Text = GetString(Resource.String.PosAffect5);
break;
}
_seekBarPosAffect = FindViewById<SeekBar>(Resource.Id.seekBarPosAffect);
_LeftPosAffect = FindViewById<ImageView> (Resource.Id.imageViewLeftPosAffect);
_RightPosAffect = FindViewById<ImageView> (Resource.Id.imageViewRightPosAffect);
nProgressPosAffect = _seekBarPosAffect.Progress;
_seekBarPosAffect.SetOnSeekBarChangeListener(this);
_seekBarNegAffect = FindViewById<SeekBar>(Resource.Id.seekBarNegAffect);
_LeftNegAffect = FindViewById<ImageView> (Resource.Id.imageViewLeftNegAffect);
_RightNegAffect = FindViewById<ImageView> (Resource.Id.imageViewRightNegAffect);
nProgressNegAffect = _seekBarNegAffect.Progress;
_seekBarNegAffect.SetOnSeekBarChangeListener(this);
switch (negQuestion) {
case 0:
negAffectText.Text = GetString(Resource.String.NegAffect1);
break;
case 1:
negAffectText.Text = GetString(Resource.String.NegAffect2);
//change sad smiley to afraid
_RightNegAffect.SetImageResource(Resource.Drawable.afraid);
break;
case 2:
negAffectText.Text = GetString(Resource.String.NegAffect3);
break;
case 3:
negAffectText.Text = GetString(Resource.String.NegAffect4);
//change sad smiley to agitated
_RightNegAffect.SetImageResource(Resource.Drawable.Agitated);
break;
case 4:
negAffectText.Text = GetString(Resource.String.NegAffect5);
//change sad smiley to angry
_RightNegAffect.SetImageResource(Resource.Drawable.angry);
//.........这里部分代码省略.........
示例4: OnCreateView
protected override View OnCreateView(ViewGroup parent)
{
var view = base.OnCreateView(parent);
_seekBar = view.FindViewById<SeekBar>(Sessions.Android.Resource.Id.seekBarPreference_seekBar);
_lblTitle = view.FindViewById<TextView>(Sessions.Android.Resource.Id.seekBarPreference_lblTitle);
_lblMinValue = view.FindViewById<TextView>(Sessions.Android.Resource.Id.seekBarPreference_lblMinValue);
_lblMaxValue = view.FindViewById<TextView>(Sessions.Android.Resource.Id.seekBarPreference_lblMaxValue);
_lblValue = view.FindViewById<TextView>(Sessions.Android.Resource.Id.seekBarPreference_lblValue);
_lblTitle.Text = _title;
_seekBar.Max = _maxValue;
_seekBar.SetOnSeekBarChangeListener(this);
var layout = (LinearLayout) view;
layout.SetPadding(0, 0, 0, 0);
layout.Orientation = Orientation.Vertical;
// Hide standard preference widgets
int childCount = layout.ChildCount;
for (int i = 0; i < childCount; i++)
{
var v = layout.GetChildAt(i);
if(v.Id != Android.Resource.Id.WidgetFrame)
v.Visibility = ViewStates.Gone;
}
return view;
}
示例5: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);
SetContentView(Resource.Layout.PieChartLayout);
//mChart = new PieChart(this);
//SetContentView(mChart);
#if true
tvX = (TextView) FindViewById(Resource.Id.tvXMax);
tvY = (TextView) FindViewById(Resource.Id.tvYMax);
mSeekBarX = (SeekBar) FindViewById(Resource.Id.seekBar1);
mSeekBarY = (SeekBar) FindViewById(Resource.Id.seekBar2);
mSeekBarY.Progress = 10;
mSeekBarX.SetOnSeekBarChangeListener(this);
mSeekBarY.SetOnSeekBarChangeListener(this);
#endif
#if true
mChart = (PieChart) FindViewById(Resource.Id.chart1);
mChart.SetUsePercentValues(true);
mChart.SetDescription("");
mChart.SetExtraOffsets(5, 10, 5, 5);
mChart.DragDecelerationFrictionCoef = 0.95f;
//tf = Typeface.CreateFromAsset(Assets, "OpenSans-Regular.ttf");
//mChart.SetCenterTextTypeface(Typeface.CreateFromAsset(Assets, "OpenSans-Light.ttf"));
mChart.CenterText = "MPAndroidChart developed by Philipp Jahoda";
//mChart.setcenter CenterText = new SpannableString(mChart.) Spanable generateCenterSpannableText();
mChart.DrawHoleEnabled = true;
mChart.SetHoleColorTransparent(true);
mChart.SetTransparentCircleColor(Color.White);
mChart.SetTransparentCircleAlpha(110);
mChart.HoleRadius = 58f;
mChart.TransparentCircleRadius = 61f;
mChart.SetDrawCenterText(true);
mChart.RotationAngle = 0;
// enable rotation of the chart by touch
mChart.RotationEnabled = true;
mChart.HighlightEnabled = true;
// mChart.setUnit(" €");
// mChart.setDrawUnitsInChart(true);
// add a selection listener
mChart.SetOnChartValueSelectedListener(this);
SetData(3, 100);
mChart.AnimateY(1400, Easing.EasingOption.EaseInOutQuad);
// mChart.spin(2000, 0, 360);
var l = mChart.Legend;
l.Position = Legend.LegendPosition.RightOfChart;
l.XEntrySpace = 7f;
l.YEntrySpace = 0f;
l.YOffset = 0f;
// Create your application here
#endif
}
示例6: InitializeUi
private void InitializeUi(Activity activity)
{
if (IsUiInitialized) return;
_startButton = activity.FindViewById<Button>(Resource.Id.StartButton);
_startButton.Enabled = EnableStartButtonFlag;
_cancelButton = activity.FindViewById<Button>(Resource.Id.CancelButton);
_feedbackButton = activity.FindViewById<Button>(Resource.Id.FeedbackButton);
_statusText = activity.FindViewById<TextView>(Resource.Id.StatusText);
_resultText = activity.FindViewById<TextView>(Resource.Id.Result);
_animationView = activity.FindViewById<ImageView>(Resource.Id.AnimationView);
_smartPhoneView = activity.FindViewById<ImageView>(Resource.Id.SmartphoneImage);
_resultViews = activity.FindViewById<LinearLayout>(Resource.Id.ResultsView);
_countdownText = activity.FindViewById<TextView>(Resource.Id.CountdownText);
_manualText = activity.FindViewById<TextView>(Resource.Id.ManualText1);
_manualText2 = activity.FindViewById<TextView>(Resource.Id.ManualText2);
_progressBar = activity.FindViewById<SeekBar>(Resource.Id.SeekBar);
_progressBar.SetOnSeekBarChangeListener(this);
_progressBar.Touch += OnTouchProgressBar;
_progressBar.SetThumb(activity.Resources.GetDrawable(Resource.Drawable.thumb_green));
_progressBar.ProgressDrawable = activity.Resources.GetDrawable(Resource.Drawable.progress_seekbar_green);
_progressBar.Max = MaxProgress;
_progressBar.Progress = 0;
_dontShowAgainBox = activity.FindViewById<CheckBox>(Resource.Id.DontShowAgainBox);
_dontShowAgainBox.Visibility = ViewStates.Invisible;
var preferences = PreferenceManager.GetDefaultSharedPreferences(SkillStoreApplication.AppContext);
_dontShowAgainBox.Checked = preferences.GetBoolean(SettingsKey.ShowAgainPreference, false);
IsUiInitialized = true;
}
示例7: InitPreference
private void InitPreference(Context context, IAttributeSet attrs)
{
SetValuesFromXml(attrs);
seekBar = new SeekBar (context, attrs);
seekBar.Max = maxValue - minValue;
seekBar.SetOnSeekBarChangeListener (this);
this.WidgetLayoutResource = Resource.Layout.seek_bar_preference;
}
示例8: OnCreate
//use a scrollview: http://stackoverflow.com/questions/4055537/how-do-you-make-a-linearlayout-scrollable
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
//CHECK HOW OFTEN WE ALREADY TESTED TODAY
dbMood = new MoodDatabase(this);
cursor = dbMood.ReadableDatabase.RawQuery("SELECT date, QuestionFlags FROM MoodData WHERE date = '" + DateTime.Now.ToString("dd.MM.yy") + "'", null); // cursor query
if (cursor.Count >= 5) { //IF ALREADY 5 OR MORE RETURN TO HOME
Toast toast = Toast.MakeText (this, GetString (Resource.String.Already5Times), ToastLength.Long);
toast.SetGravity (GravityFlags.Center, 0, 0);
toast.Show ();
//create an intent to go back to the home screen
Intent intent = new Intent (this, typeof(Home));
intent.SetFlags (ActivityFlags.ClearTop); //remove the history and go back to home screen
StartActivity (intent);
} else { //OTHERWISE LOAD THE SCREEN AND START
// Create your application here
SetContentView (Resource.Layout.MoodAssessment);
//select random background picture
//find view with background
LinearLayout LayoutMood = FindViewById<LinearLayout>(Resource.Id.LinearLayoutMood);
rnd = new Random(); //generator is seeded each time it is initialized
switch (rnd.Next (7)) {
case 0:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.clouds_low));
break;
case 1:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.beach_gauss));
break;
case 2:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.dawn_low));
break;
case 3:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.flower_pink_low));
break;
case 4:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.flower_red_low));
break;
case 5:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.forest_low));
break;
case 6:
LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.sea_low));
break;
}
//CHOOSE QUESTIONS TO ASK
//rnd = new Random(); //generator is seeded each time it is initialized
//take latest db entry from today and read out which questions have already been asked.
//if there is no enry yet, set already asked to 0
int alreadyAsked = 0; //default value: no questions have been asked yet
if (cursor.Count > 0) { //data was already saved today and questions have been asked, so retrieve which ones have been asked
cursor.MoveToLast (); //take the last entry of today
alreadyAsked = cursor.GetInt(cursor.GetColumnIndex("QuestionFlags")); //retrieve value from last entry in db column QuestionFlags
}
//This was for testing purposes
//int alreadyAsked = 1 + 4 + 8 + 32 + 64 + 128 ; //only 1 and 4 are still valid options for pos and 3 & 4 for neg
int posQuestion = ChoosePositiveQuestion (alreadyAsked);
int negQuestion = ChooseNegativeQuestion (alreadyAsked);
//update alreadyAsked with the newly chosen questions, only write to db after the save button has been pressed
alreadyAsked += (int)Math.Pow(2,posQuestion) + (int)Math.Pow(2,negQuestion+5);
//Toast.MakeText(this, "New Asked: " + alreadyAsked.ToString(), ToastLength.Short).Show();
//Provide the chosen questions with seekbars and smileys. Make sure to pick good smileys for the negative affect questions
//CODE FOR POSITIVE AND NEGATIVE SEEKBAR QUESTIONS
TextView posAffectText = FindViewById<TextView>(Resource.Id.textViewPosAffect);
TextView negAffectText = FindViewById<TextView>(Resource.Id.textViewNegAffect);
switch (posQuestion) {
case 0:
posAffectText.Text = GetString(Resource.String.PosAffect1);
break;
case 1:
posAffectText.Text = GetString(Resource.String.PosAffect2);
break;
case 2:
posAffectText.Text = GetString(Resource.String.PosAffect3);
break;
case 3:
posAffectText.Text = GetString(Resource.String.PosAffect4);
break;
case 4:
posAffectText.Text = GetString(Resource.String.PosAffect5);
break;
}
_seekBarPosAffect = FindViewById<SeekBar>(Resource.Id.seekBarPosAffect);
_LeftPosAffect = FindViewById<ImageView> (Resource.Id.imageViewLeftPosAffect);
_RightPosAffect = FindViewById<ImageView> (Resource.Id.imageViewRightPosAffect);
nProgressPosAffect = _seekBarPosAffect.Progress;
_seekBarPosAffect.SetOnSeekBarChangeListener(this);
_seekBarNegAffect = FindViewById<SeekBar>(Resource.Id.seekBarNegAffect);
_LeftNegAffect = FindViewById<ImageView> (Resource.Id.imageViewLeftNegAffect);
_RightNegAffect = FindViewById<ImageView> (Resource.Id.imageViewRightNegAffect);
nProgressNegAffect = _seekBarNegAffect.Progress;
//.........这里部分代码省略.........
示例9: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
subTotalTextView = FindViewById<TextView>(Resource.Id.lblSubTotal);
generosityTextView = FindViewById<TextView>(Resource.Id.lblGenerosity);
tipToLeaveTextView = FindViewById<TextView>(Resource.Id.lblTipToLeave);
tipTextView = FindViewById<TextView>(Resource.Id.lblTip);
generositySeekBar = FindViewById<SeekBar>(Resource.Id.seekGenerosityProgress);
subTotalEditText = FindViewById<EditText>(Resource.Id.txtSubTotal);
generositySeekBar.SetOnSeekBarChangeListener(new SeekBarChangeListener(this));
subTotalEditText.AfterTextChanged += (sender, e) =>
{
double value = 0;
try
{
value = Double.Parse(subTotalEditText.Text.ToString());
}
catch (Exception)
{
value = 0;
throw;
}
ViewModel.SubTotal = value;
tipTextView.Text = ViewModel.Tip.ToString();
};
}