本文整理汇总了Java中android.widget.NumberPicker.setDisplayedValues方法的典型用法代码示例。如果您正苦于以下问题:Java NumberPicker.setDisplayedValues方法的具体用法?Java NumberPicker.setDisplayedValues怎么用?Java NumberPicker.setDisplayedValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.NumberPicker
的用法示例。
在下文中一共展示了NumberPicker.setDisplayedValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_study_mode_settings_page);
biologyButton = (ToggleButton) findViewById(R.id.biologyButton);
chemistryButton = (ToggleButton) findViewById(R.id.chemistryButton);
earthAndSpaceButton = (ToggleButton) findViewById(R.id.earthAndSpaceButton);
energyButton = (ToggleButton) findViewById(R.id.energyButton);
mathButton = (ToggleButton) findViewById(R.id.mathButton);
physicsButton = (ToggleButton) findViewById(R.id.physicsButton);
randomButton = (ToggleButton) findViewById(R.id.randomButton);
roundNumPicker = (NumberPicker) findViewById(R.id.roundNumPicker);
roundNumPicker.setMinValue(0);
roundNumPicker.setMaxValue(roundOptions.length-1);
roundNumPicker.setWrapSelectorWheel(false);
roundNumPicker.setDisplayedValues(roundOptions);
menuButton = (Button) findViewById(R.id.menuButton);
}
开发者ID:jakepolatty,项目名称:HighSchoolScienceBowlPractice-Android,代码行数:22,代码来源:StudyModeSettingsPage.java
示例2: onCreate
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_age);
final EditText ageEdit = (EditText) findViewById(R.id.age);
ageEdit.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
hideKeyboard(v);
ageEdit.setCursorVisible(false);
} else {
showKeyboard(v);
ageEdit.setCursorVisible(true);
}
}
});
NumberPicker numberPicker = (NumberPicker) findViewById(R.id.numberPicker);
numberPicker.setMaxValue(28);
numberPicker.setMinValue(1);
NumberPicker stringPicker = (NumberPicker) findViewById(R.id.stringPicker);
stringPicker.setMaxValue(2);
stringPicker.setMinValue(0);
stringPicker.setDisplayedValues( new String[] { "Days", "Months", "Years" } );
}
示例3: onCreate
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reader_mode_settings_page);
setNumPicker = (NumberPicker) findViewById(R.id.setNumPicker);
setNumPicker.setMinValue(0);
setNumPicker.setMaxValue(setOptions.length-1);
setNumPicker.setWrapSelectorWheel(false);
setNumPicker.setDisplayedValues(setOptions);
roundNumPicker = (NumberPicker) findViewById(R.id.roundNumPicker);
roundNumPicker.setMinValue(0);
roundNumPicker.setMaxValue(roundOptions.length-1);
roundNumPicker.setWrapSelectorWheel(false);
roundNumPicker.setDisplayedValues(roundOptions);
tossupTimeSpinner = (Spinner) findViewById(R.id.tossupTimeSelector);
bonusTimeSpinner = (Spinner) findViewById(R.id.bonusTimeSelector);
menuButton = (Button) findViewById(R.id.menuButton);
}
开发者ID:jakepolatty,项目名称:HighSchoolScienceBowlPractice-Android,代码行数:23,代码来源:ReaderModeSettingsPage.java
示例4: onCreate
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
controlToggle = (ToggleButton) findViewById(R.id.toggle_control);
mStatusTextView = (TextView) findViewById(R.id.tv_status);
mStatusTextView.setMovementMethod(new ScrollingMovementMethod());
mResultProgress = (ProgressBar) findViewById(R.id.progress);
mResultProgress.setMax(100);
NumberPicker picker = (NumberPicker) findViewById(R.id.number_picker);
picker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
picker.setOnValueChangedListener(this);
picker.setDisplayedValues(mSampleSizes);
picker.setMinValue(0);
picker.setMaxValue(mSampleSizes.length - 1);
picker.setWrapSelectorWheel(true);
picker.setValue(0);
mSampleSize = 1;
Logger.i("Sample size initial value: %s", mSampleSize);
checkPermissions();
}
示例5: onCreateView
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_new_periodic_care, container, false);
goalPicker = (NumberPicker) view.findViewById(R.id.goal_picker);
punishmentPicker = (NumberPicker) view.findViewById(R.id.punishment_picker);
lengthPicker = (NumberPicker) view.findViewById(R.id.length_picker);
unitPicker = (NumberPicker) view.findViewById(R.id.unit_picker);
goalPicker.setMaxValue(Integer.MAX_VALUE);
goalPicker.setMinValue(1);
goalPicker.setWrapSelectorWheel(false);
punishmentPicker.setMaxValue(Integer.MAX_VALUE);
punishmentPicker.setMinValue(0);
punishmentPicker.setValue(1);
punishmentPicker.setWrapSelectorWheel(false);
lengthPicker.setMaxValue(Integer.MAX_VALUE);
lengthPicker.setMinValue(1);
lengthPicker.setWrapSelectorWheel(false);
unitPicker.setDisplayedValues(getResources().getStringArray(R.array.period_units));
unitPicker.setMaxValue(3);
unitPicker.setMinValue(0);
unitPicker.setValue(3);
unitPicker.setWrapSelectorWheel(true);
return view;
}
示例6: SetSnoozePickerValues
import android.widget.NumberPicker; //导入方法依赖的package包/类
static void SetSnoozePickerValues(NumberPicker picker, boolean above, int default_snooze) {
String[] values=new String[snoozeValues.length];
for(int i=0;i<values.length;i++){
values[i]=getNameFromTime(snoozeValues[i]);
}
picker.setMaxValue(values.length -1);
picker.setMinValue(0);
picker.setDisplayedValues(values);
picker.setWrapSelectorWheel(false);
if(default_snooze != 0) {
picker.setValue(getSnoozeLocatoin(default_snooze));
} else {
picker.setValue(getSnoozeLocatoin(getDefaultSnooze(above)));
}
}
示例7: initPicker
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected void initPicker() {
mProvincePicker = (NumberPicker) findViewById(R.id.province);
mCityPicker = (NumberPicker) findViewById(R.id.city);
mProvincePicker.setDisplayedValues(mProvinceNames);
mProvincePicker.setMinValue(0);
mProvincePicker.setMaxValue(mAreas.size() - 1);
mProvincePicker.setOnValueChangedListener(this);
int provinceIndex = getDefaultProvinceIndex(mProvince);
mProvincePicker.setValue(provinceIndex);
updateCityPicker(provinceIndex);
int cityIndex = getDefaultCityIndex(provinceIndex, mCity);
mCityPicker.setValue(cityIndex);
}
示例8: onCreate
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.language_selection);
mPrefs=PreferenceManager.getInstance(this);
if(!mPrefs.getLoginFirstTime()){
startMainActivity();
}
mSelecLanguage= (Button) findViewById(R.id.btn_select_lan);
mLanguageSelector= (NumberPicker) findViewById(R.id.numberPicker);
mLanguageSelector.setMaxValue(1);
mLanguageSelector.setMinValue(0);
mLanguageSelector.setDisplayedValues(getResources().getStringArray(R.array.languages));
mLanguageSelector.setOnValueChangedListener(this);
mSelecLanguage.setOnClickListener(this);
}
示例9: createNumberPicker
import android.widget.NumberPicker; //导入方法依赖的package包/类
public NumberPicker createNumberPicker(final String[] names, final int level) {
NumberPicker numberPicker = new NumberPicker(getContext());
numberPicker.setTag(level);
LinearLayout.LayoutParams params = new LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.leftMargin = 5;
params.rightMargin = 5;
numberPicker.setLayoutParams(params);
numberPicker.setWrapSelectorWheel(true);
numberPicker.setOnValueChangedListener(this);
numberPicker.setMinValue(0);
numberPicker.setMaxValue(names.length - 1);
numberPicker.setDisplayedValues(names);
return numberPicker;
}
示例10: setUpMinutePicker
import android.widget.NumberPicker; //导入方法依赖的package包/类
protected void setUpMinutePicker(View view) {
minutePicker = (NumberPicker) view.findViewById(R.id.picker1);
minutePicker.setMaxValue(MAX_VALUE);
minutePicker.setMinValue(MIN_VALUE);
minutePicker.setValue(sharedPreferences.getInt("nagMinutes", getContext().getResources().getInteger(R.integer.default_nag_minutes)));
String[] minuteValues = new String[61];
for (int i = 0; i < minuteValues.length; i++) {
minuteValues[i] = String.format(getContext().getResources().getQuantityString(R.plurals.time_minute, i), i);
}
minutePicker.setDisplayedValues(minuteValues);
}
示例11: setUpSecondPicker
import android.widget.NumberPicker; //导入方法依赖的package包/类
protected void setUpSecondPicker(View view) {
secondPicker = (NumberPicker) view.findViewById(R.id.picker2);
secondPicker.setMaxValue(MAX_VALUE);
secondPicker.setMinValue(MIN_VALUE);
secondPicker.setValue(sharedPreferences.getInt("nagSeconds", getContext().getResources().getInteger(R.integer.default_nag_seconds)));
String[] secondValues = new String[61];
for (int i = 0; i < secondValues.length; i++) {
secondValues[i] = String.format(getContext().getResources().getQuantityString(R.plurals.time_second, i), i);
}
secondPicker.setDisplayedValues(secondValues);
}
示例12: onCreateView
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_new_subperiodic_care, container, false);
goalPicker = (NumberPicker) view.findViewById(R.id.goal_picker);
subGoalPicker = (NumberPicker) view.findViewById(R.id.sub_goal_picker);
punishmentPicker = (NumberPicker) view.findViewById(R.id.punishment_picker);
lengthPicker = (NumberPicker) view.findViewById(R.id.length_picker);
unitPicker = (NumberPicker) view.findViewById(R.id.unit_picker);
goalPicker.setMaxValue(Integer.MAX_VALUE);
goalPicker.setMinValue(1);
goalPicker.setWrapSelectorWheel(false);
subGoalPicker.setMaxValue(Integer.MAX_VALUE);
subGoalPicker.setMinValue(2);
subGoalPicker.setWrapSelectorWheel(false);
punishmentPicker.setMaxValue(Integer.MAX_VALUE);
punishmentPicker.setMinValue(0);
punishmentPicker.setValue(1);
punishmentPicker.setWrapSelectorWheel(false);
lengthPicker.setMaxValue(Integer.MAX_VALUE);
lengthPicker.setMinValue(1);
lengthPicker.setWrapSelectorWheel(false);
unitPicker.setDisplayedValues(getResources().getStringArray(R.array.period_units));
unitPicker.setMaxValue(3);
unitPicker.setMinValue(0);
unitPicker.setValue(3);
unitPicker.setWrapSelectorWheel(true);
return view;
}
示例13: showDialog
import android.widget.NumberPicker; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void showDialog() {
if (mDialog == null) {
View view = ((LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.view_number_picker_dialog, null);
// build NumberPicker
mPicker = (NumberPicker) view.findViewById(R.id.number_picker);
if (mStep > 1) {
mValues = new String[(mMax - mMin) / mStep + 1];
for (int i = 0; i < mValues.length; i++) {
mValues[i] = Integer.toString(mMin + mStep * i);
}
mPicker.setMinValue(0);
mPicker.setMaxValue((mMax - mMin) / mStep);
mPicker.setDisplayedValues(mValues);
} else {
mPicker.setMaxValue(mMax);
mPicker.setMinValue(mMin);
mPicker.setValue(mCurrentValue);
}
// build save button
Button saveButton = (Button) view.findViewById(R.id.btn_save);
saveButton.setOnClickListener(this);
// build dialog
mDialog = new AlertDialog.Builder(getContext())
.setTitle(mTitle)
.setView(view)
.setCancelable(true)
.create();
mDialog.setCanceledOnTouchOutside(true);
}
mDialog.show();
}
示例14: initPickerData
import android.widget.NumberPicker; //导入方法依赖的package包/类
private void initPickerData(NumberPicker picker, String[] data) {
if(data == null || data.length < 1) return;
picker.setDisplayedValues(null);
picker.setMinValue(0);
picker.setMaxValue(data.length - 1);
picker.setWrapSelectorWheel(false);
picker.setDisplayedValues(data);
}
示例15: onCreateDialogView
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected View onCreateDialogView() {
prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
numberPicker = new NumberPicker(getContext());
numberPicker.setMinValue(minValue);
numberPicker.setMaxValue(maxValue);
String[] displayedValues =new String[maxValue-minValue+1];
for(int i=minValue;i<=maxValue;i++){
displayedValues[i-minValue]=Integer.toString(i*multiplier);
}
numberPicker.setDisplayedValues(displayedValues);
numberPicker.setValue(prefs.getInt(pref_key, defaultDisplayValue)/multiplier);
return numberPicker;
}