本文整理汇总了Java中android.widget.SeekBar.setPadding方法的典型用法代码示例。如果您正苦于以下问题:Java SeekBar.setPadding方法的具体用法?Java SeekBar.setPadding怎么用?Java SeekBar.setPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.SeekBar
的用法示例。
在下文中一共展示了SeekBar.setPadding方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPrepareDialogBuilder
import android.widget.SeekBar; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onPrepareDialogBuilder(Builder builder) {
Context context = getContext();
ViewGroup.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mValue = getPersistedInt(DEFAULT_VALUE);
LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setLayoutParams(params);
mValueText = new TextView(context);
mValueText.setGravity(Gravity.RIGHT);
mValueText.setPadding(20, 0, 20, 0);
layout.addView(mValueText);
SeekBar seekBar = new SeekBar(context);
seekBar.setPadding(20, 0, 20, 20);
seekBar.setLayoutParams(params);
seekBar.setMax(1000);
seekBar.setProgress((int) (Math.pow((float) (mValue - MIN) / (MAX - MIN), 0.25f) * 1000));
seekBar.setOnSeekBarChangeListener(this);
layout.addView(seekBar);
updateText();
builder.setView(layout);
}
示例2: onPrepareDialogBuilder
import android.widget.SeekBar; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onPrepareDialogBuilder(Builder builder) {
Context context = getContext();
ViewGroup.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mValue = getPersistedInt(95);
LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setLayoutParams(params);
mValueText = new TextView(context);
mValueText.setGravity(Gravity.RIGHT);
mValueText.setPadding(20, 0, 20, 0);
mValueText.setText(getSummary(-mValue));
layout.addView(mValueText);
SeekBar seekBar = new SeekBar(context);
seekBar.setPadding(20, 0, 20, 20);
seekBar.setLayoutParams(params);
seekBar.setMax(150);
seekBar.setProgress(mValue);
seekBar.setOnSeekBarChangeListener(this);
layout.addView(seekBar);
builder.setView(layout);
}