android.widget.SeekBar.setProgress()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(302)

本文整理了Java中android.widget.SeekBar.setProgress()方法的一些代码示例,展示了SeekBar.setProgress()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SeekBar.setProgress()方法的具体详情如下:
包路径:android.widget.SeekBar
类名称:SeekBar
方法名:setProgress

SeekBar.setProgress介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

int stepSize = 5;
public void onProgressChanged(SeekBar seekBar, int progress,
          boolean fromUser) {
  progress = ((int)Math.round(progress/stepSize))*stepSize;
  seekBar.setProgress(progress);
  textview.setText(progress + "");

}

代码示例来源:origin: commonsguy/cw-omnibus

public void setColor(int color) {
 red.setProgress(Color.red(color));
 green.setProgress(Color.green(color));
 blue.setProgress(Color.blue(color));
 swatch.setBackgroundColor(color);
}

代码示例来源:origin: lipangit/JiaoZiVideoPlayer

public void onStateAutoComplete() {
  Log.i(TAG, "onStateAutoComplete " + " [" + this.hashCode() + "] ");
  currentState = CURRENT_STATE_AUTO_COMPLETE;
  cancelProgressTimer();
  progressBar.setProgress(100);
  currentTimeTextView.setText(totalTimeTextView.getText());
}

代码示例来源:origin: TeamNewPipe/NewPipe

private void setTempoSlider(final double newTempo) {
  if (tempoSlider == null) return;
  tempoSlider.setProgress(strategy.progressOf(newTempo));
}

代码示例来源:origin: TeamNewPipe/NewPipe

private void setPitchSlider(final double newPitch) {
  if (pitchSlider == null) return;
  pitchSlider.setProgress(strategy.progressOf(newPitch));
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

protected void loopSetProgressAndTime() {
  if (mProgressBar == null || mTotalTimeTextView == null || mCurrentTimeTextView == null) {
    return;
  }
  mProgressBar.setProgress(0);
  mProgressBar.setSecondaryProgress(0);
  mCurrentTimeTextView.setText(CommonUtil.stringForTime(0));
  if (mBottomProgressBar != null)
    mBottomProgressBar.setProgress(0);
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

@Override
public void onStopTrackingTouch(SeekBar seekBar) {
  if (mOpenPreView) {
    if (mPreProgress >= 0) {
      seekBar.setProgress(mPreProgress);
    }
    super.onStopTrackingTouch(seekBar);
    mIsFromUser = false;
    mPreviewLayout.setVisibility(GONE);
  } else {
    super.onStopTrackingTouch(seekBar);
  }
}

代码示例来源:origin: lipangit/JiaoZiVideoPlayer

public void onProgress(int progress, long position, long duration) {
//        Log.d(TAG, "onProgress: progress=" + progress + " position=" + position + " duration=" + duration);
    if (!mTouchingProgressBar) {
      if (seekToManulPosition != -1) {
        if (seekToManulPosition > progress) {
          return;
        } else {
          seekToManulPosition = -1;
        }
      } else {
        if (progress != 0) progressBar.setProgress(progress);
      }
    }
    if (position != 0) currentTimeTextView.setText(JZUtils.stringForTime(position));
    totalTimeTextView.setText(JZUtils.stringForTime(duration));
  }

代码示例来源:origin: CarGuo/GSYVideoPlayer

@Override
protected void cloneParams(GSYBaseVideoPlayer from, GSYBaseVideoPlayer to) {
  super.cloneParams(from, to);
  StandardGSYVideoPlayer sf = (StandardGSYVideoPlayer) from;
  StandardGSYVideoPlayer st = (StandardGSYVideoPlayer) to;
  if (st.mProgressBar != null && sf.mProgressBar != null) {
    st.mProgressBar.setProgress(sf.mProgressBar.getProgress());
    st.mProgressBar.setSecondaryProgress(sf.mProgressBar.getSecondaryProgress());
  }
  if (st.mTotalTimeTextView != null && sf.mTotalTimeTextView != null) {
    st.mTotalTimeTextView.setText(sf.mTotalTimeTextView.getText());
  }
  if (st.mCurrentTimeTextView != null && sf.mCurrentTimeTextView != null) {
    st.mCurrentTimeTextView.setText(sf.mCurrentTimeTextView.getText());
  }
}

代码示例来源:origin: lipangit/JiaoZiVideoPlayer

public void resetProgressAndTime() {
  progressBar.setProgress(0);
  progressBar.setSecondaryProgress(0);
  currentTimeTextView.setText(JZUtils.stringForTime(0));
  totalTimeTextView.setText(JZUtils.stringForTime(0));
}

代码示例来源:origin: seven332/EhViewer

@Override
protected void onBindView(View view) {
  super.onBindView(view);
  SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar);
  seekBar.setOnSeekBarChangeListener(this);
  seekBar.setMax(mMax);
  seekBar.setProgress(mProgress);
  seekBar.setEnabled(isEnabled());
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

protected void resetProgressAndTime() {
  if (mProgressBar == null || mTotalTimeTextView == null || mCurrentTimeTextView == null) {
    return;
  }
  mProgressBar.setProgress(0);
  mProgressBar.setSecondaryProgress(0);
  mCurrentTimeTextView.setText(CommonUtil.stringForTime(0));
  mTotalTimeTextView.setText(CommonUtil.stringForTime(0));
  if (mBottomProgressBar != null) {
    mBottomProgressBar.setProgress(0);
    mBottomProgressBar.setSecondaryProgress(0);
  }
}

代码示例来源:origin: smuyyh/BookReader

private void calcFontSize(int progress) {
  // progress range 1 - 10
  if (progress >= 0 && progress <= 10) {
    seekbarFontSize.setProgress(progress);
    mPageWidget.setFontSize(ScreenUtils.dpToPxInt(12 + 1.7f * progress));
  }
}

代码示例来源:origin: smuyyh/BookReader

@Override
public synchronized void setProgress(int progress) {
  super.setProgress(progress);
  onSizeChanged(getWidth(), getHeight(), 0, 0);
}

代码示例来源:origin: smuyyh/BookReader

@Override
  public void onChange(boolean selfChange) {
    super.onChange(selfChange);
    //LogUtils.d("BrightnessOnChange:" + ScreenUtils.getScreenBrightnessInt255());
    if (!ScreenUtils.isAutoBrightness(ReadActivity.this)) {
      seekbarLightness.setProgress(ScreenUtils.getScreenBrightness());
    }
  }
};

代码示例来源:origin: smuyyh/BookReader

@OnClick(R.id.ivBrightnessPlus)
public void brightnessPlus() {
  int curBrightness = SettingManager.getInstance().getReadBrightness();
  if (!SettingManager.getInstance().isAutoBrightness()) {
    seekbarLightness.setProgress((curBrightness = curBrightness + 2));
    ScreenUtils.saveScreenBrightnessInt255(curBrightness, ReadActivity.this);
  }
}

代码示例来源:origin: smuyyh/BookReader

/***************Setting Menu*****************/
@OnClick(R.id.ivBrightnessMinus)
public void brightnessMinus() {
  int curBrightness = SettingManager.getInstance().getReadBrightness();
  if (curBrightness > 5 && !SettingManager.getInstance().isAutoBrightness()) {
    seekbarLightness.setProgress((curBrightness = curBrightness - 2));
    ScreenUtils.saveScreenBrightnessInt255(curBrightness, ReadActivity.this);
  }
}

代码示例来源:origin: robolectric/robolectric

@Test
public void testOnChangeNotification() {
 seekBar.setProgress(5);
 assertThat(transcript).containsExactly("onProgressChanged() - 5");
}

代码示例来源:origin: smuyyh/BookReader

private void stopAutoLightness() {
  SettingManager.getInstance().saveAutoBrightness(false);
  ScreenUtils.stopAutoBrightness(ReadActivity.this);
  seekbarLightness.setProgress((int) (ScreenUtils.getScreenBrightnessInt255() / 255.0F * 100));
  seekbarLightness.setEnabled(true);
}

代码示例来源:origin: PhilJay/MPAndroidChart

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
      WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_performance_linechart);
  setTitle("PerformanceLineChart");
  tvCount = findViewById(R.id.tvValueCount);
  seekBarValues = findViewById(R.id.seekbarValues);
  seekBarValues.setOnSeekBarChangeListener(this);
  chart = findViewById(R.id.chart1);
  chart.setDrawGridBackground(false);
  // no description text
  chart.getDescription().setEnabled(false);
  // enable touch gestures
  chart.setTouchEnabled(true);
  // enable scaling and dragging
  chart.setDragEnabled(true);
  chart.setScaleEnabled(true);
  // if disabled, scaling can be done on x- and y-axis separately
  chart.setPinchZoom(false);
  chart.getAxisLeft().setDrawGridLines(false);
  chart.getAxisRight().setEnabled(false);
  chart.getXAxis().setDrawGridLines(true);
  chart.getXAxis().setDrawAxisLine(false);
  seekBarValues.setProgress(9000);
  // don't forget to refresh the drawing
  chart.invalidate();
}

相关文章

SeekBar类方法