本文整理汇总了Java中android.widget.SeekBar.setProgress方法的典型用法代码示例。如果您正苦于以下问题:Java SeekBar.setProgress方法的具体用法?Java SeekBar.setProgress怎么用?Java SeekBar.setProgress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.SeekBar
的用法示例。
在下文中一共展示了SeekBar.setProgress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initSeekBar
import android.widget.SeekBar; //导入方法依赖的package包/类
private void initSeekBar(SeekBar seekBar, Uri defaultUri) {
seekBar.setMax(mAudioManager.getStreamMaxVolume(mStreamType));
mOriginalStreamVolume = mAudioManager.getStreamVolume(mStreamType);
seekBar.setProgress(mOriginalStreamVolume);
seekBar.setOnSeekBarChangeListener(this);
// TODO: removed in MM, find different approach
mContext.getContentResolver().registerContentObserver(
System.getUriFor("volume_ring"),
false, mVolumeObserver);
if (defaultUri == null) {
if (mStreamType == AudioManager.STREAM_RING) {
defaultUri = Settings.System.DEFAULT_RINGTONE_URI;
} else if (mStreamType == AudioManager.STREAM_NOTIFICATION) {
defaultUri = Settings.System.DEFAULT_NOTIFICATION_URI;
} else {
defaultUri = Settings.System.DEFAULT_ALARM_ALERT_URI;
}
}
mRingtone = RingtoneManager.getRingtone(mContext, defaultUri);
if (mRingtone != null) {
mRingtone.setStreamType(mStreamType);
}
}
示例2: onCreate
import android.widget.SeekBar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_texture_from_camera);
mHandler = new MainHandler(this);
SurfaceView sv = (SurfaceView) findViewById(R.id.cameraOnTexture_surfaceView);
SurfaceHolder sh = sv.getHolder();
sh.addCallback(this);
mZoomBar = (SeekBar) findViewById(R.id.tfcZoom_seekbar);
mSizeBar = (SeekBar) findViewById(R.id.tfcSize_seekbar);
mRotateBar = (SeekBar) findViewById(R.id.tfcRotate_seekbar);
mZoomBar.setProgress(DEFAULT_ZOOM_PERCENT);
mSizeBar.setProgress(DEFAULT_SIZE_PERCENT);
mRotateBar.setProgress(DEFAULT_ROTATE_PERCENT);
mZoomBar.setOnSeekBarChangeListener(this);
mSizeBar.setOnSeekBarChangeListener(this);
mRotateBar.setOnSeekBarChangeListener(this);
updateControls();
}
示例3: onProgressChanged
import android.widget.SeekBar; //导入方法依赖的package包/类
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
try{
int newValue = progress + mMinValue;
if(newValue > mMaxValue)
newValue = mMaxValue;
else if(newValue < mMinValue)
newValue = mMinValue;
else if(mInterval != 1 && newValue % mInterval != 0)
newValue = Math.round(((float) newValue) / mInterval)*mInterval;
// change rejected, revert to the previous value
if(!callChangeListener(newValue)){
seekBar.setProgress(mCurrentValue - mMinValue);
return;
}
// change accepted, store it
mCurrentValue = newValue;
mStatusText.setText(String.valueOf(newValue));
persistInt(newValue);
}catch(NullPointerException ex) {
return;
}
}
示例4: refreshDisplay
import android.widget.SeekBar; //导入方法依赖的package包/类
private void refreshDisplay() {
TextView brightnessText = (TextView) findViewById(R.id.brightness);
brightnessText.setText(getString(R.string.brightness) + " "
+ getBrightness() + "%");
SeekBar slider = (SeekBar) findViewById(R.id.slider);
slider.setProgress(getBrightness());
// Show/Hide the auto brightness check box.
CheckBox checkbox = (CheckBox) findViewById(R.id.auto_brightness);
if (Util.supportsAutoBrightness(getContentResolver())) {
checkbox.setVisibility(View.VISIBLE);
if (Util.getAutoBrightnessEnabled(getContentResolver())) {
checkbox.setChecked(true);
lockBrightnessControls(true);
} else {
checkbox.setChecked(false);
lockBrightnessControls(false);
}
} else {
checkbox.setVisibility(View.GONE);
lockBrightnessControls(false);
}
}
示例5: 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);
}
示例6: getView
import android.widget.SeekBar; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TGChannel channel = (TGChannel) this.getItem(position);
View view = (convertView != null ? convertView : getLayoutInflater().inflate(R.layout.view_channel_list_item, parent, false));
view.setTag(channel);
view.setOnClickListener(this.channelList.getActionHandler().createEditChannelAction(channel));
view.setOnLongClickListener(this.channelList.getActionHandler().createChannelItemMenuAction(channel));
TextView textViewName = (TextView) view.findViewById(R.id.channel_item_name);
textViewName.setText(channel.getName());
SeekBar seekBarVolume = (SeekBar) view.findViewById(R.id.channel_item_volume_value);
seekBarVolume.setTag(channel);
seekBarVolume.setProgress(channel.getVolume());
seekBarVolume.setOnSeekBarChangeListener(this.createVolumeChangeListener());
return view;
}
示例7: updateBars
import android.widget.SeekBar; //导入方法依赖的package包/类
private void updateBars()
{
try
{
for (Map.Entry<Short, SeekBar> entry : bars.entrySet())
{
short band = entry.getKey();
SeekBar bar = entry.getValue();
bar.setEnabled(equalizer.getEnabled());
short minEQLevel = equalizer.getBandLevelRange()[0];
bar.setProgress(equalizer.getBandLevel(band) - minEQLevel);
}
}
catch (Exception ex)
{
//TODO: Show a dialog
}
}
示例8: 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));
}
示例9: onBindView
import android.widget.SeekBar; //导入方法依赖的package包/类
@Override
protected void onBindView(View view) {
Log.i(TAG, "SeekbarPreference----onBindView");
super.onBindView(view);
progress = getPersistedInt(60);
seekBar = (SeekBar) view.findViewById(R.id.id_seekbar_threshold);
textView = (TextView) view.findViewById(R.id.id_tv_threshold_value);
seekBar.setMax(maxValue);
seekBar.setProgress(progress);
seekBar.setEnabled(isEnabled());
seekBar.setOnSeekBarChangeListener(this);
textView.setText(getSummary());
}
示例10: onBindView
import android.widget.SeekBar; //导入方法依赖的package包/类
@Override
protected void onBindView(View view) {
super.onBindView(view);
mSeekBar = (SeekBar) view.findViewById(R.id.seekbar);
mSeekBar.setProgress(mProgress);
mSeekBar.setOnSeekBarChangeListener(this);
}
示例11: initOptions
import android.widget.SeekBar; //导入方法依赖的package包/类
private void initOptions(View root) {
mWithShadow = SharePreferencesUtils.withShadow(getActivity(), false);
mTextSize = SharePreferencesUtils.textSize(getActivity(), mDefaultTextSize);
SeekBar seekBar = (SeekBar) root.findViewById(R.id.text_size);
seekBar.setProgress((mTextSize - mMinTextSize) / mSpanPerSegment);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(), R.array.gif_source_array, android.R.layout.simple_spinner_dropdown_item);
mGifSourceSpinner.setAdapter(adapter);
int source = SharePreferencesUtils.getInt(getContext(), KEY_GIF_SORUCE);
mGifSourceSpinner.setSelection(source);
}
示例12: onCheckedChanged
import android.widget.SeekBar; //导入方法依赖的package包/类
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mChecked = isChecked;
// update flag immediately
setUseRingerVolume(mChecked);
SeekBar seek = mNotificationHolder.seek;
if (isChecked) {
seek.setEnabled(false);
seek.setProgress(mRingerHolder.seek.getProgress());
mNotificationHolder.text.setText(mRingerHolder.text.getText());
} else {
seek.setEnabled(true);
}
}
示例13: CustomColourDialog
import android.widget.SeekBar; //导入方法依赖的package包/类
public CustomColourDialog(final Context context) {
super(context);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.setContentView(R.layout.customcolourdialog);
this.setCancelable(false);
Button closeButton = (Button) this
.findViewById(R.id.returnColourDialog);
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
saveButton = (Button) this.findViewById(R.id.shareColourDialog);
rSeekBar = (SeekBar) findViewById(R.id.rSeekBar);
rSeekBar.setMax(255);
rSeekBar.setProgress(111);
rSeekBar.setOnSeekBarChangeListener(rgbOnSeekBarListener());
gSeekBar = (SeekBar) findViewById(R.id.gSeekBar);
gSeekBar.setMax(255);
gSeekBar.setProgress(111);
gSeekBar.setOnSeekBarChangeListener(rgbOnSeekBarListener());
bSeekBar = (SeekBar) findViewById(R.id.bSeekBar);
bSeekBar.setMax(255);
bSeekBar.setProgress(111);
bSeekBar.setOnSeekBarChangeListener(rgbOnSeekBarListener());
calculateRGB();
}
示例14: onCreate
import android.widget.SeekBar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart_sinus);
mSinusData = FileUtils.loadBarEntriesFromAssets(getAssets(), "othersine.txt");
tvX = (TextView) findViewById(R.id.tvValueCount);
mSeekBarX = (SeekBar) findViewById(R.id.seekbarValues);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setDrawBarShadow(false);
mChart.setDrawValueAboveBar(true);
mChart.getDescription().setEnabled(false);
// if more than 60 entries are displayed in the chart, no values will be
// drawn
mChart.setMaxVisibleValueCount(60);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
// draw shadows for each bar that show the maximum value
// mChart.setDrawBarShadow(true);
// mChart.setDrawXLabels(false);
mChart.setDrawGridBackground(false);
// mChart.setDrawYLabels(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setEnabled(false);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(mTfLight);
leftAxis.setLabelCount(6, false);
leftAxis.setAxisMinimum(-2.5f);
leftAxis.setAxisMaximum(2.5f);
leftAxis.setGranularityEnabled(true);
leftAxis.setGranularity(0.1f);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setTypeface(mTfLight);
rightAxis.setLabelCount(6, false);
rightAxis.setAxisMinimum(-2.5f);
rightAxis.setAxisMaximum(2.5f);
rightAxis.setGranularity(0.1f);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarX.setProgress(150); // set data
Legend l = mChart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
l.setForm(LegendForm.SQUARE);
l.setFormSize(9f);
l.setTextSize(11f);
l.setXEntrySpace(4f);
mChart.animateXY(2000, 2000);
}
示例15: onCreate
import android.widget.SeekBar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvX.setTextSize(10);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.getDescription().setEnabled(false);
// mChart.setDrawBorders(true);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawBarShadow(false);
mChart.setDrawGridBackground(false);
// create a custom MarkerView (extend MarkerView) and specify the layout
// to use for it
MyMarkerView mv = new MyMarkerView(this, R.layout.custom_marker_view);
mv.setChartView(mChart); // For bounds control
mChart.setMarker(mv); // Set the marker to the chart
mSeekBarX.setProgress(10);
mSeekBarY.setProgress(100);
Legend l = mChart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
l.setOrientation(Legend.LegendOrientation.VERTICAL);
l.setDrawInside(true);
l.setTypeface(mTfLight);
l.setYOffset(0f);
l.setXOffset(10f);
l.setYEntrySpace(0f);
l.setTextSize(8f);
XAxis xAxis = mChart.getXAxis();
xAxis.setTypeface(mTfLight);
xAxis.setGranularity(1f);
xAxis.setCenterAxisLabels(true);
xAxis.setValueFormatter(new IAxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
return String.valueOf((int) value);
}
});
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(mTfLight);
leftAxis.setValueFormatter(new LargeValueFormatter());
leftAxis.setDrawGridLines(false);
leftAxis.setSpaceTop(35f);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
mChart.getAxisRight().setEnabled(false);
}