本文整理汇总了C#中Android.Widget.SeekBar.SetThumb方法的典型用法代码示例。如果您正苦于以下问题:C# SeekBar.SetThumb方法的具体用法?C# SeekBar.SetThumb怎么用?C# SeekBar.SetThumb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Widget.SeekBar
的用法示例。
在下文中一共展示了SeekBar.SetThumb方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetTheme
public static void SetTheme(SeekBar seekBar, FlatTheme theme)
{
// setting thumb
var thumb = new PaintDrawable(theme.DarkAccentColor);
thumb.SetCornerRadius(15);
thumb.SetIntrinsicWidth(30);
thumb.SetIntrinsicHeight(30);
seekBar.SetThumb(thumb);
// progress
var progress = new PaintDrawable(theme.BackgroundColor);
progress.SetCornerRadius(10);
progress.SetIntrinsicHeight(10);
progress.SetIntrinsicWidth(5);
progress.SetDither(true);
var progressClip = new ClipDrawable(progress, GravityFlags.Left, ClipDrawableOrientation.Horizontal);
// secondary progress
var secondary = new PaintDrawable(theme.LightAccentColor);
secondary.SetCornerRadius(10);
secondary.SetIntrinsicHeight(10);
var secondaryProgressClip = new ClipDrawable(secondary, GravityFlags.Left, ClipDrawableOrientation.Horizontal);
// background
PaintDrawable background = new PaintDrawable(theme.VeryLightAccentColor);
background.SetCornerRadius(10);
background.SetIntrinsicHeight(10);
// applying drawable
LayerDrawable ld = (LayerDrawable) seekBar.ProgressDrawable;
ld.SetDrawableByLayerId(Android.Resource.Id.Background, background);
ld.SetDrawableByLayerId(Android.Resource.Id.Progress, progressClip);
ld.SetDrawableByLayerId(Android.Resource.Id.SecondaryProgress, secondaryProgressClip);
}
示例2: SetTint
public static void SetTint(SeekBar seekBar, Color color)
{
ColorStateList s1 = ColorStateList.ValueOf(color);
if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
seekBar.ThumbTintList = s1;
seekBar.ProgressTintList = s1;
}
else if (Build.VERSION.SdkInt > BuildVersionCodes.GingerbreadMr1)
{
Drawable progressDrawable = DrawableCompat.Wrap(seekBar.ProgressDrawable);
seekBar.ProgressDrawable = progressDrawable;
DrawableCompat.SetTintList(progressDrawable, s1);
if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBean)
{
Drawable thumbDrawable = DrawableCompat.Wrap(seekBar.Thumb);
DrawableCompat.SetTintList(thumbDrawable, s1);
seekBar.SetThumb(thumbDrawable);
}
}
else
{
PorterDuff.Mode mode = PorterDuff.Mode.SrcIn;
if (Build.VERSION.SdkInt <= BuildVersionCodes.GingerbreadMr1)
{
mode = PorterDuff.Mode.Multiply;
}
if (seekBar.IndeterminateDrawable != null)
seekBar.IndeterminateDrawable.SetColorFilter(color, mode);
if (seekBar.ProgressDrawable != null)
seekBar.ProgressDrawable.SetColorFilter(color, mode);
}
}
示例3: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Slider> e)
{
base.OnElementChanged(e);
control = (SeekBar)Control;
//control.ScaleY = 3;
//control.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.drag_bg));
formsSlider = (CustomSlider)this.Element;
formsSlider.Value = 1;
formsSlider.CurrentValue = 1;
FeelingNowPage.sliderValue = 1;
Android.Graphics.Drawables.Drawable drawable = Resources.GetDrawable(Resource.Drawable.drag_btn);
control.SetThumb(drawable);
control.ProgressChanged += control_ProgressChanged;
control.StopTrackingTouch += control_StopTrackingTouch;
control.StartTrackingTouch += control_StartTrackingTouch;
}
示例4: ChangeSeekBarColorAnalyzerNotFailed
private void ChangeSeekBarColorAnalyzerNotFailed(SeekBar seekBar)
{
if ((seekBar.Progress == MaxProgress && AnalyzerSuccessful) || seekBar.Progress == 0)
{
seekBar.SetThumb(Resources.GetDrawable(Resource.Drawable.thumb_green));
seekBar.ProgressDrawable = Resources.GetDrawable(Resource.Drawable.progress_seekbar_green);
return;
}
seekBar.SetThumb(Resources.GetDrawable(Resource.Drawable.thumb_yellow));
seekBar.ProgressDrawable = Resources.GetDrawable(Resource.Drawable.progress_seekbar_yellow);
}
示例5: ChangeSeekBarColor
private void ChangeSeekBarColor(SeekBar seekBar)
{
if (AnalyzerFailed)
{
seekBar.SetThumb(Resources.GetDrawable(Resource.Drawable.thumb_red));
seekBar.ProgressDrawable = Resources.GetDrawable(Resource.Drawable.progress_seekbar_red);
return;
}
ChangeSeekBarColorAnalyzerNotFailed(seekBar);
}
示例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;
}