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

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

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

SeekBar.setMax介绍

暂无

代码示例

代码示例来源:origin: jiajunhui/PlayerBase

private void setBottomSeekProgress(int curr, int duration){
  mBottomSeekBar.setMax(duration);
  mBottomSeekBar.setProgress(curr);
  float secondProgress = mBufferPercentage * 1.0f/100 * duration;
  mBottomSeekBar.setSecondaryProgress((int) secondProgress);
}

代码示例来源:origin: jiajunhui/PlayerBase

private void setSeekProgress(int curr, int duration){
  mSeekBar.setMax(duration);
  mSeekBar.setProgress(curr);
  float secondProgress = mBufferPercentage * 1.0f/100 * duration;
  setSecondProgress((int) secondProgress);
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
protected void onBindDialogView(View v) {
  super.onBindDialogView(v);
  mSeekBar.setMax((mMax - mMin) / mInterval);
  mSeekBar.setProgress((mValue - mMin) / mInterval);
}

代码示例来源:origin: hussien89aa/AndroidTutorialForBeginners

@Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    SongInfo songInfo=SongsList.get(position);
    mp=new MediaPlayer();
    try {
      mp.setDataSource(songInfo.Path);
      mp.prepare();
      mp.start();
      seekBar1.setMax(mp.getDuration());
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
});

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

@Override
public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.main);
 
 thingToResize=findViewById(R.id.resize);

 horizontal=(SeekBar)findViewById(R.id.horizontal);  
 vertical=(SeekBar)findViewById(R.id.vertical);
 
 horizontal.setMax(144); // 240 less 96 starting size
 vertical.setMax(144);  // keep it square @ max
 
 horizontal.setOnSeekBarChangeListener(h);
 vertical.setOnSeekBarChangeListener(v);
}

代码示例来源:origin: k9mail/k-9

@Override
protected View onCreateDialogView() {
  mSeekBarValue = (int) (mValue * SEEKBAR_RESOLUTION);
  View view = super.onCreateDialogView();
  SeekBar seekbar = view.findViewById(R.id.slider_preference_seekbar);
  seekbar.setMax(SEEKBAR_RESOLUTION);
  seekbar.setProgress(mSeekBarValue);
  seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
    }
    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
    }
    @Override
    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
      if (fromUser) {
        SliderPreference.this.mSeekBarValue = progress;
        callChangeListener((float) SliderPreference.this.mSeekBarValue / SEEKBAR_RESOLUTION);
      }
    }
  });
  return view;
}

代码示例来源: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: TeamNewPipe/NewPipe

private void setupPitchControl(@NonNull View rootView) {
  pitchSlider = rootView.findViewById(R.id.pitchSeekbar);
  TextView pitchMinimumText = rootView.findViewById(R.id.pitchMinimumText);
  TextView pitchMaximumText = rootView.findViewById(R.id.pitchMaximumText);
  pitchCurrentText = rootView.findViewById(R.id.pitchCurrentText);
  pitchStepDownText = rootView.findViewById(R.id.pitchStepDown);
  pitchStepUpText = rootView.findViewById(R.id.pitchStepUp);
  if (pitchCurrentText != null)
    pitchCurrentText.setText(PlayerHelper.formatPitch(pitch));
  if (pitchMaximumText != null)
    pitchMaximumText.setText(PlayerHelper.formatPitch(MAXIMUM_PLAYBACK_VALUE));
  if (pitchMinimumText != null)
    pitchMinimumText.setText(PlayerHelper.formatPitch(MINIMUM_PLAYBACK_VALUE));
  if (pitchSlider != null) {
    pitchSlider.setMax(strategy.progressOf(MAXIMUM_PLAYBACK_VALUE));
    pitchSlider.setProgress(strategy.progressOf(pitch));
    pitchSlider.setOnSeekBarChangeListener(getOnPitchChangedListener());
  }
}

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

private void setupTempoControl(@NonNull View rootView) {
  tempoSlider = rootView.findViewById(R.id.tempoSeekbar);
  TextView tempoMinimumText = rootView.findViewById(R.id.tempoMinimumText);
  TextView tempoMaximumText = rootView.findViewById(R.id.tempoMaximumText);
  tempoCurrentText = rootView.findViewById(R.id.tempoCurrentText);
  tempoStepUpText = rootView.findViewById(R.id.tempoStepUp);
  tempoStepDownText = rootView.findViewById(R.id.tempoStepDown);
  if (tempoCurrentText != null)
    tempoCurrentText.setText(PlayerHelper.formatSpeed(tempo));
  if (tempoMaximumText != null)
    tempoMaximumText.setText(PlayerHelper.formatSpeed(MAXIMUM_PLAYBACK_VALUE));
  if (tempoMinimumText != null)
    tempoMinimumText.setText(PlayerHelper.formatSpeed(MINIMUM_PLAYBACK_VALUE));
  if (tempoSlider != null) {
    tempoSlider.setMax(strategy.progressOf(MAXIMUM_PLAYBACK_VALUE));
    tempoSlider.setProgress(strategy.progressOf(tempo));
    tempoSlider.setOnSeekBarChangeListener(getOnTempoChangedListener());
  }
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
protected View onCreateDialogView() {
  LinearLayout.LayoutParams params;
  LinearLayout layout = new LinearLayout(mContext);
  layout.setOrientation(LinearLayout.VERTICAL);
  layout.setPadding(6, 6, 6, 6);
  mValueText = new TextView(mContext);
  mValueText.setGravity(Gravity.CENTER_HORIZONTAL);
  mValueText.setTextSize(32);
  params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
      LinearLayout.LayoutParams.WRAP_CONTENT);
  layout.addView(mValueText, params);
  mSeekBar = new SeekBar(mContext);
  mSeekBar.setOnSeekBarChangeListener(this);
  layout.addView(mSeekBar, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
      LinearLayout.LayoutParams.WRAP_CONTENT));
  if (shouldPersist()) {
    mValue = getPersistedInt(mDefault);
  }
  mSeekBar.setMax((mMax - mMin) / mInterval);
  mSeekBar.setProgress((mValue - mMin) / mInterval);
  String t = String.valueOf(mValue);
  mValueText.setText(mSuffix == null ? t : t.concat(mSuffix));
  return layout;
}

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

red.setMax(0xFF);
red.setOnSeekBarChangeListener(onMix);
green.setMax(0xFF);
green.setOnSeekBarChangeListener(onMix);
blue.setMax(0xFF);
blue.setOnSeekBarChangeListener(onMix);

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

@Override
public void onPrepared(boolean playWhenReady) {
  if (DEBUG) Log.d(TAG, "onPrepared() called with: playWhenReady = [" + playWhenReady + "]");
  playbackSeekBar.setMax((int) simpleExoPlayer.getDuration());
  playbackEndTime.setText(getTimeString((int) simpleExoPlayer.getDuration()));
  playbackSpeedTextView.setText(formatSpeed(getPlaybackSpeed()));
  super.onPrepared(playWhenReady);
}

代码示例来源:origin: xfumihiro/ViewInspector

@Override public void onAttachedToWindow() {
 super.onAttachedToWindow();
 SeekBar seekBar = (SeekBar) findViewById(R.id.seekbar);
 seekBar.setMax(SAMPLE_MAX_VAL);
 seekBar.setProgress(profileProgressbar.getSamples());
 final TextView sampleTextView = (TextView) findViewById(R.id.sample);
 sampleTextView.setText(String.valueOf(profileProgressbar.getSamples()));
 mProfileSample = profileProgressbar.getSamples();
 seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
  @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
   mProfileSample = progress / SAMPLE_STEP_SIZE * SAMPLE_STEP_SIZE;
   if (mProfileSample == 0) mProfileSample = SAMPLE_MIN_VAL;
   seekBar.setProgress(mProfileSample);
   sampleTextView.setText(String.valueOf(mProfileSample));
  }
  @Override public void onStartTrackingTouch(SeekBar seekBar) {
  }
  @Override public void onStopTrackingTouch(SeekBar seekBar) {
  }
 });
}

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

@Override
public void onProgressUpdate(int currentProgress, int duration, int bufferPercent) {
  // Set buffer progress
  progressSeekBar.setSecondaryProgress((int) (progressSeekBar.getMax() * ((float) bufferPercent / 100)));
  // Set Duration
  progressSeekBar.setMax(duration);
  progressEndTime.setText(Localization.getDurationString(duration / 1000));
  // Set current time if not seeking
  if (!seeking) {
    progressSeekBar.setProgress(currentProgress);
    progressCurrentTime.setText(Localization.getDurationString(currentProgress / 1000));
  }
  if (player != null) {
    progressLiveSync.setClickable(!player.isLiveEdge());
  }
  // this will make shure progressCurrentTime has the same width as progressEndTime
  final ViewGroup.LayoutParams endTimeParams = progressEndTime.getLayoutParams();
  final ViewGroup.LayoutParams currentTimeParams = progressCurrentTime.getLayoutParams();
  currentTimeParams.width = progressEndTime.getWidth();
  progressCurrentTime.setLayoutParams(currentTimeParams);
}

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

@Override
public void onUpdateProgress(int currentProgress, int duration, int bufferPercent) {
  if (!isPrepared()) return;
  if (duration != playbackSeekBar.getMax()) {
    playbackEndTime.setText(getTimeString(duration));
    playbackSeekBar.setMax(duration);
  }
  if (currentState != STATE_PAUSED) {
    if (currentState != STATE_PAUSED_SEEK) playbackSeekBar.setProgress(currentProgress);
    playbackCurrentTime.setText(getTimeString(currentProgress));
  }
  if (simpleExoPlayer.isLoading() || bufferPercent > 90) {
    playbackSeekBar.setSecondaryProgress((int) (playbackSeekBar.getMax() * ((float) bufferPercent / 100)));
  }
  if (DEBUG && bufferPercent % 20 == 0) { //Limit log
    Log.d(TAG, "updateProgress() called with: isVisible = " + isControlsVisible() + ", currentProgress = [" + currentProgress + "], duration = [" + duration + "], bufferPercent = [" + bufferPercent + "]");
  }
  playbackLiveSync.setClickable(!isLiveEdge());
}

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

ThemeManager.setReaderTheme(curTheme, mRlBookReadRoot);
seekbarFontSize.setMax(10);
seekbarFontSize.setOnSeekBarChangeListener(new SeekBarChangeListener());
seekbarLightness.setMax(100);
seekbarLightness.setOnSeekBarChangeListener(new SeekBarChangeListener());
seekbarLightness.setProgress(ScreenUtils.getScreenBrightness());

代码示例来源:origin: naman14/Timber

mSeekBar.setMax((int) MusicPlayer.duration());
mProgress.postDelayed(mUpdateProgress, 10);

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

seekBarX.setMax(700);

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

seekBarX.setMax(50);
seekBarX.setOnSeekBarChangeListener(this);

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

seekBarY.setMax(180);
seekBarY.setOnSeekBarChangeListener(this);

相关文章

SeekBar类方法