本文整理了Java中android.widget.SeekBar.getContext()
方法的一些代码示例,展示了SeekBar.getContext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SeekBar.getContext()
方法的具体详情如下:
包路径:android.widget.SeekBar
类名称:SeekBar
方法名:getContext
暂无
代码示例来源:origin: lingochamp/okdownload
@Override public void onStopTrackingTouch(SeekBar seekBar) {
if (isFromUser) {
final int priority = seekBar.getProgress();
setPriority(task, priority);
holder.priorityTv
.setText(seekBar.getContext()
.getString(R.string.priority, priority));
}
}
});
代码示例来源:origin: GreatApo/GreatFit
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
Toast.makeText(seekBar.getContext(), "Target: "+seekBar.getProgress(), Toast.LENGTH_SHORT).show();
}
}, target_calories, 3000));
代码示例来源:origin: GreatApo/GreatFit
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
Toast.makeText(seekBar.getContext(), "Refresh rate: "+seekBar.getProgress()+" sec", Toast.LENGTH_SHORT).show();
}
}, custom_refresh_rate, 60));
代码示例来源:origin: GreatApo/GreatFit
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
Toast.makeText(seekBar.getContext(), "Time diff: "+(seekBar.getProgress()/2f-12)+" hours", Toast.LENGTH_SHORT).show();
}
}, (int) (world_time_zone+12)*2, 47));
代码示例来源:origin: techery/progresshint
public ProgressHintDelegate(SeekBar seekBar, AttributeSet attrs, int defStyleAttr) {
TypedArray a = seekBar.getContext().obtainStyledAttributes(attrs, R.styleable.ProgressHint, defStyleAttr, R.style.Widget_ProgressHint);
//
int mPopupLayout = a.getResourceId(R.styleable.ProgressHint_popupLayout, R.layout.progress_hint_popup);
int mPopupOffset = (int) a.getDimension(R.styleable.ProgressHint_popupOffset, 0);
int mPopupStyle = a.getInt(R.styleable.ProgressHint_popupStyle, ProgressHintDelegate.POPUP_FOLLOW);
int mPopupAnimStyle = a.getResourceId(R.styleable.ProgressHint_popupAnimationStyle, R.style.ProgressHintPopupAnimation);
boolean mPopupAlwaysShown = a.getBoolean(R.styleable.ProgressHint_popupAlwaysShown, false);
boolean mPopupDraggable = a.getBoolean(R.styleable.ProgressHint_popupDraggable, false);
a.recycle();
//
initDelegate(seekBar, mPopupLayout, mPopupOffset, mPopupAlwaysShown, mPopupDraggable, mPopupStyle, mPopupAnimStyle);
}
代码示例来源:origin: techery/progresshint
private void initHintPopup() {
String popupText = null;
if (mHintAdapter != null) {
popupText = mHintAdapter.getHint(mSeekBar, mSeekBar.getProgress());
}
// init views
LayoutInflater inflater = (LayoutInflater) mSeekBar.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mPopupView = inflater.inflate(mPopupLayout, null);
mPopupView.measure(makeMeasureSpec(0, UNSPECIFIED), makeMeasureSpec(0, UNSPECIFIED));
mPopupTextView = mPopupView.findViewById(android.R.id.text1);
mPopupTextView.setText(popupText != null ? popupText : String.valueOf(mSeekBar.getProgress()));
// init popup
mPopup = new PopupWindow(mPopupView, WRAP_CONTENT, WRAP_CONTENT, false);
mPopup.setAnimationStyle(mPopupAnimStyle);
}
代码示例来源:origin: garretyoder/app-theme-engine
public static void setTint(@NonNull SeekBar seekBar, @ColorInt int color, boolean useDarker) {
final ColorStateList s1 = getDisabledColorStateList(color,
ContextCompat.getColor(seekBar.getContext(), useDarker ? R.color.ate_control_disabled_dark : R.color.ate_control_disabled_light));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
seekBar.setThumbTintList(s1);
seekBar.setProgressTintList(s1);
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
Drawable progressDrawable = createTintedDrawable(seekBar.getProgressDrawable(), s1);
seekBar.setProgressDrawable(progressDrawable);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
Drawable thumbDrawable = createTintedDrawable(seekBar.getThumb(), s1);
seekBar.setThumb(thumbDrawable);
}
} else {
PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN;
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
mode = PorterDuff.Mode.MULTIPLY;
}
if (seekBar.getIndeterminateDrawable() != null)
seekBar.getIndeterminateDrawable().setColorFilter(color, mode);
if (seekBar.getProgressDrawable() != null)
seekBar.getProgressDrawable().setColorFilter(color, mode);
}
}
代码示例来源:origin: wutongke/AndroidSkinAnimator
super.loadFromAttributes(attrs, defStyleAttr);
TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), attrs,
R.styleable.AppCompatSeekBar, defStyleAttr, 0);
mThumbResId = a.getResourceId(R.styleable.AppCompatSeekBar_android_thumb, INVALID_ID);
代码示例来源:origin: xuancao/DynamicSkin
public static void setTint(@NonNull SeekBar seekBar, @ColorInt int color, boolean useDarker) {
final ColorStateList s1 = getDisabledColorStateList(color,
ContextCompat.getColor(seekBar.getContext(), useDarker ? R.color.ate_disabled_seekbar_dark : R.color.ate_disabled_seekbar_light));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
seekBar.setThumbTintList(s1);
seekBar.setProgressTintList(s1);
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
Drawable progressDrawable = DrawableCompat.wrap(seekBar.getProgressDrawable());
seekBar.setProgressDrawable(progressDrawable);
DrawableCompat.setTintList(progressDrawable, s1);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
Drawable thumbDrawable = DrawableCompat.wrap(seekBar.getThumb());
DrawableCompat.setTintList(thumbDrawable, s1);
seekBar.setThumb(thumbDrawable);
}
} else {
PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN;
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
mode = PorterDuff.Mode.MULTIPLY;
}
if (seekBar.getIndeterminateDrawable() != null)
seekBar.getIndeterminateDrawable().setColorFilter(color, mode);
if (seekBar.getProgressDrawable() != null)
seekBar.getProgressDrawable().setColorFilter(color, mode);
}
}
代码示例来源:origin: h4h13/RetroMusicPlayer
public static void setTint(@NonNull SeekBar seekBar, @ColorInt int color, boolean useDarker) {
final ColorStateList s1 = getDisabledColorStateList(color, ContextCompat.getColor(seekBar.getContext(), useDarker ? R.color.ate_control_disabled_dark : R.color.ate_control_disabled_light));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
seekBar.setThumbTintList(s1);
seekBar.setProgressTintList(s1);
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
Drawable progressDrawable = createTintedDrawable(seekBar.getProgressDrawable(), s1);
seekBar.setProgressDrawable(progressDrawable);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
Drawable thumbDrawable = createTintedDrawable(seekBar.getThumb(), s1);
seekBar.setThumb(thumbDrawable);
}
} else {
PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN;
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
mode = PorterDuff.Mode.MULTIPLY;
}
if (seekBar.getIndeterminateDrawable() != null)
seekBar.getIndeterminateDrawable().setColorFilter(color, mode);
if (seekBar.getProgressDrawable() != null)
seekBar.getProgressDrawable().setColorFilter(color, mode);
}
}
内容来源于网络,如有侵权,请联系作者删除!