本文整理汇总了Java中android.widget.SeekBar类的典型用法代码示例。如果您正苦于以下问题:Java SeekBar类的具体用法?Java SeekBar怎么用?Java SeekBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SeekBar类属于android.widget包,在下文中一共展示了SeekBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPanel
import android.widget.SeekBar; //导入依赖的package包/类
private ViewGroup getPanel(Context context, int type) {
final ViewGroup mViewGroup = new LinearLayout(context);
LinearLayout.LayoutParams btnParam =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
// btnParam.weight = 1;
btnParam.gravity = Gravity.CENTER_VERTICAL;
LinearLayout.LayoutParams seekBarParam =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
seekBarParam.weight = 1;
seekBarParam.gravity = Gravity.CENTER;
ImageButton btnBack = new ImageButton(context);
btnBack.setImageBitmap(backBitmap);
btnBack.setScaleType(ImageView.ScaleType.FIT_CENTER);
btnBack.setBackgroundColor(Color.alpha(255));
SeekBar seekBar = getSeekBar(context, type);
ImageButton btnFunc = new ImageButton(context);
btnFunc.setImageBitmap(funcBitmap);
btnFunc.setScaleType(ImageView.ScaleType.FIT_CENTER);
btnFunc.setBackgroundColor(Color.alpha(255));
mViewGroup.addView(btnBack, btnParam);
mViewGroup.addView(seekBar, seekBarParam);
mViewGroup.addView(btnFunc, btnParam);
final WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
mViewGroup.setBackgroundColor(Color.BLACK);
btnBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
wm.removeView(mViewGroup);
}
});
return mViewGroup;
}
示例2: onStartTrackingTouch
import android.widget.SeekBar; //导入依赖的package包/类
public void onStartTrackingTouch(SeekBar bar) {
mHandler.removeMessages(MSG_HIDE_CONTROLLER);
mDragging = true;
mSeekComplete = false;
// By removing these pending progress messages we make sure
// that a) we won't update the progress while the user adjusts
// the seekbar and b) once the user is done dragging the thumb
// we will post one of these messages to the queue again and
// this ensures that there will be exactly one message queued up.
if (Player.sPlayer.isPlaying()) {
mSeekWasPlaying = true;
Player.sPlayer.pause();
}
else
mSeekWasPlaying=false;
}
示例3: onProgressChanged
import android.widget.SeekBar; //导入依赖的package包/类
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (videoMediaPlayer == null) {
return;
}
if (!fromUser) {
// We're not interested in programmatically generated changes to
// the progress bar's position.
return;
}
long duration = videoMediaPlayer.getDuration();
long newPosition = (duration * progress) / Constants.ONE_MILLISECOND;
videoMediaPlayer.seekTo((int) newPosition);
if (currentTime != null) {
currentTime.setText(stringForTime((int) newPosition));
}
}
示例4: bindViews
import android.widget.SeekBar; //导入依赖的package包/类
private void bindViews() {
selectedColorPreview = findViewById(R.id.selected_color_preview);
seekBarRed = (SeekBar) findViewById(R.id.seekbar_red);
seekBarRed.setMax(COLOR_MAX_VALUE);
seekBarRed.setOnSeekBarChangeListener(this);
seekBarBlue = (SeekBar) findViewById(R.id.seekbar_blue);
seekBarBlue.setMax(COLOR_MAX_VALUE);
seekBarBlue.setOnSeekBarChangeListener(this);
seekBarGreen = (SeekBar) findViewById(R.id.seekbar_green);
seekBarGreen.setMax(COLOR_MAX_VALUE);
seekBarGreen.setOnSeekBarChangeListener(this);
seekBarAlpha = (SeekBar) findViewById(R.id.seekbar_alpha);
seekBarAlpha.setMax(COLOR_MAX_VALUE);
seekBarAlpha.setProgress(COLOR_MAX_VALUE);
seekBarAlpha.setOnSeekBarChangeListener(this);
}
示例5: initStokeWidthPopWindow
import android.widget.SeekBar; //导入依赖的package包/类
private void initStokeWidthPopWindow() {
popView = LayoutInflater.from(activity).
inflate(R.layout.view_set_stoke_width, null);
setStokenWidthWindow = new PopupWindow(popView, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
mStokenWidthSeekBar = (SeekBar) popView.findViewById(R.id.stoke_width_seekbar);
setStokenWidthWindow.setFocusable(true);
setStokenWidthWindow.setOutsideTouchable(true);
setStokenWidthWindow.setBackgroundDrawable(new BitmapDrawable());
setStokenWidthWindow.setAnimationStyle(R.style.popwin_anim_style);
mPaintModeView.setPaintStrokeColor(Color.RED);
mPaintModeView.setPaintStrokeWidth(10);
updatePaintView();
}
示例6: onCreateDialog
import android.widget.SeekBar; //导入依赖的package包/类
@SuppressLint("InflateParams")
public Dialog onCreateDialog() {
tgPlayRateList = generatePercent();
final View view = getActivity().getLayoutInflater().inflate(R.layout.view_toolbar_playrate_dialog, null);
this.seekBar = (SeekBar) view.findViewById(R.id.toolbar_percent_seekbar);
this.textView = (TextView) view.findViewById(R.id.toolbar_percent_textview);
this.seekBar.setMax(tgPlayRateList.size() - 1);
this.initPlayRate();
this.appendListeners(seekBar);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.toolbar_playrate_dlg_title);
builder.setView(view);
return builder.create();
}
示例7: onFinishInflate
import android.widget.SeekBar; //导入依赖的package包/类
@Override
public void onFinishInflate() {
super.onFinishInflate();
mRadioGroup = (RadioGroup) findViewById(R.id.radio_button_group);
mColorModeButtons.put(Theme.LIGHT,
initializeAndGetButton(R.id.light_mode, Theme.LIGHT));
mColorModeButtons.put(Theme.DARK,
initializeAndGetButton(R.id.dark_mode, Theme.DARK));
mColorModeButtons.put(Theme.SEPIA,
initializeAndGetButton(R.id.sepia_mode, Theme.SEPIA));
mColorModeButtons.get(mDistilledPagePrefs.getTheme()).setChecked(true);
mFontScaleSeekBar = (SeekBar) findViewById(R.id.font_size);
mFontScaleTextView = (TextView) findViewById(R.id.font_size_percentage);
mFontFamilySpinner = (Spinner) findViewById(R.id.font_family);
initFontFamilySpinner();
// Setting initial progress on font scale seekbar.
onChangeFontScaling(mDistilledPagePrefs.getFontScaling());
mFontScaleSeekBar.setOnSeekBarChangeListener(this);
}
示例8: startWithDefaultProperty
import android.widget.SeekBar; //导入依赖的package包/类
@Test
public void startWithDefaultProperty() throws Exception
{
Property property = new Property();
ActivityController controller = startWithProperty(property);
Activity activity = (Activity)controller.get();
SeekBar yearSeeker = (SeekBar)activity.findViewById(R.id.yearSeeker);
// The first shown year should be year 1, or index 0.
assertEquals(0, yearSeeker.getProgress());
Map<Integer, String> expectedValues = new ImmutableMap.Builder<Integer, String>()
.put(R.id.rentValue, "0")
.put(R.id.vancancyValue, "0")
.put(R.id.operatingIncomeValue, "0")
.put(R.id.operatingExpensesValue, "0")
.put(R.id.netOperatingIncomeValue, "0")
.put(R.id.mortgageValue, "0")
.put(R.id.cashFlowValue, "0")
.put(R.id.afterTaxCashFlowValue, "0")
.put(R.id.propertyValueValue, "0")
.put(R.id.loanBalanceValue, "0")
.put(R.id.totalEquityValue, "0")
.put(R.id.depreciationValue, "0")
.put(R.id.mortgageInterestValue, "0")
.put(R.id.capitalizationRateValue, "0.0")
.put(R.id.cashOnCashValue, "0.0")
.put(R.id.rentToValueValue, "0.0")
.put(R.id.grossRentMultiplierValue, "0.0")
.build();
checkFields(activity, expectedValues);
}
示例9: onStartTrackingTouch
import android.widget.SeekBar; //导入依赖的package包/类
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
Log.i(TAG, "bottomProgress onStartTrackingTouch [" + this.hashCode() + "] ");
cancelProgressTimer();
ViewParent vpdown = getParent();
while (vpdown != null) {
vpdown.requestDisallowInterceptTouchEvent(true);
vpdown = vpdown.getParent();
}
}
示例10: onStopTrackingTouch
import android.widget.SeekBar; //导入依赖的package包/类
public void onStopTrackingTouch(SeekBar bar) {
if (!mInstantSeeking) {
mPlayer.seekTo((mDuration * bar.getProgress()) / 1000);
}
if (mInfoView != null) {
mInfoView.setText("");
mInfoView.setVisibility(View.GONE);
}
show(sDefaultTimeout);
mHandler.removeMessages(SHOW_PROGRESS);
mAM.setStreamMute(AudioManager.STREAM_MUSIC, false);
mDragging = false;
mHandler.sendEmptyMessageDelayed(SHOW_PROGRESS, 1000);
}
示例11: onBindView
import android.widget.SeekBar; //导入依赖的package包/类
@Override
protected void onBindView(View view) {
super.onBindView(view);
getPreferenceManager().registerOnActivityStopListener(this);
initHandler();
final SeekBar seekBar = (SeekBar) view.findViewById(R.id.start_volume);
if (seekBar == mStartVolumeSeekBar) return;
mStartVolumeSeekBar = seekBar;
mRampUpTimeSeekBar = (SeekBar) view.findViewById(R.id.ramp_up_time);
mRampUpTimeValue = (TextView) view.findViewById(R.id.ramp_up_time_value);
final ContentResolver cr = getContext().getContentResolver();
float startVolume = CMSettings.System.getFloat(cr,
CMSettings.System.INCREASING_RING_START_VOLUME, 0.1f);
int rampUpTime = CMSettings.System.getInt(cr,
CMSettings.System.INCREASING_RING_RAMP_UP_TIME, 10);
mStartVolumeSeekBar.setProgress(Math.round(startVolume * 1000F));
mStartVolumeSeekBar.setOnSeekBarChangeListener(this);
mRampUpTimeSeekBar.setOnSeekBarChangeListener(this);
mRampUpTimeSeekBar.setProgress((rampUpTime / 5) - 1);
mRampUpTimeValue.setText(
Formatter.formatShortElapsedTime(getContext(), rampUpTime * 1000));
}
示例12: onStopTrackingTouch
import android.widget.SeekBar; //导入依赖的package包/类
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
if (!mInstantSeeking)
mPlayerListener.seekTo(mDuration * seekBar.getProgress() / 1000);
if (mInfoView != null){
mInfoView.setText("");
mInfoView.setVisibility(GONE);
}
show(sDefaultTimeout);
mHandler.removeMessages(SHOW_PROGRESS);
mAudioManager.setStreamMute(AudioManager.STREAM_MUSIC, false);
mDragging = false;
mHandler.sendEmptyMessageDelayed(SHOW_PROGRESS, 1000);
}
示例13: onStopTrackingTouch
import android.widget.SeekBar; //导入依赖的package包/类
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
long duration = mediaPlayer.getDuration();
long newPosition = (duration * seekBar.getProgress()) / videoProgress.getMax();
mediaPlayer.seekTo((int) newPosition);
isDragging = false;
post(mShowProgress);
show();
}
示例14: AudioView
import android.widget.SeekBar; //导入依赖的package包/类
public AudioView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
inflate(context, R.layout.audio_view, this);
this.container = (ViewGroup) findViewById(R.id.audio_widget_container);
this.controlToggle = (AnimatingToggle) findViewById(R.id.control_toggle);
this.playButton = (ImageView) findViewById(R.id.play);
this.pauseButton = (ImageView) findViewById(R.id.pause);
this.downloadButton = (ImageView) findViewById(R.id.download);
this.downloadProgress = (ProgressWheel) findViewById(R.id.download_progress);
this.seekBar = (SeekBar) findViewById(R.id.seek);
this.timestamp = (TextView) findViewById(R.id.timestamp);
this.playButton.setOnClickListener(new PlayClickedListener());
this.pauseButton.setOnClickListener(new PauseClickedListener());
this.seekBar.setOnSeekBarChangeListener(new SeekBarModifiedListener());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
this.playButton.setImageDrawable(context.getDrawable(R.drawable.play_icon));
this.pauseButton.setImageDrawable(context.getDrawable(R.drawable.pause_icon));
this.playButton.setBackground(context.getDrawable(R.drawable.ic_circle_fill_white_48dp));
this.pauseButton.setBackground(context.getDrawable(R.drawable.ic_circle_fill_white_48dp));
}
if (attrs != null) {
TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AudioView, 0, 0);
setTint(typedArray.getColor(R.styleable.AudioView_foregroundTintColor, Color.WHITE),
typedArray.getColor(R.styleable.AudioView_backgroundTintColor, Color.WHITE));
container.setBackgroundColor(typedArray.getColor(R.styleable.AudioView_widgetBackground, Color.TRANSPARENT));
typedArray.recycle();
}
}
示例15: updateView
import android.widget.SeekBar; //导入依赖的package包/类
private void updateView() {
mSwitchBeauty.setImageResource(isOpen ? R.drawable.kai : R.drawable.guan);
for (SeekBarRow row : seekBarRowList) {
SeekBar seekBar = row.seekBar;
seekBar.setEnabled(isOpen);
}
}