本文整理汇总了Java中android.widget.NumberPicker.OnValueChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java NumberPicker.OnValueChangeListener方法的具体用法?Java NumberPicker.OnValueChangeListener怎么用?Java NumberPicker.OnValueChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.NumberPicker
的用法示例。
在下文中一共展示了NumberPicker.OnValueChangeListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ValuePickerDialog
import android.widget.NumberPicker; //导入方法依赖的package包/类
public ValuePickerDialog(Context context, NumberPicker.OnValueChangeListener listener,
String[] values, int selectedIndex, int minIndex, int maxIndex,
CharSequence title)
{
super(context, R.style.AppTheme_AlertDialog);
this.listener = listener;
this.selectedIndex = selectedIndex;
final LayoutInflater inflater = LayoutInflater.from(context);
final View view = inflater.inflate(R.layout.dialog_number_picker, null);
setView(view);
setTitle(title);
setButton(BUTTON_POSITIVE, context.getString(android.R.string.ok), this);
setButton(BUTTON_NEGATIVE, context.getString(android.R.string.cancel), this);
numberPicker = view.findViewById(R.id.number_picker);
String[] selectableValues = Arrays.copyOfRange(values, minIndex, maxIndex+1);
numberPicker.setDisplayedValues(selectableValues);
numberPicker.setMinValue(minIndex);
numberPicker.setMaxValue(maxIndex);
numberPicker.setValue(selectedIndex);
numberPicker.setWrapSelectorWheel(false);
// do not allow keyboard input
EditText input = findInput(numberPicker);
if(input != null) input.setFocusable(false);
}
示例2: getShengPickerChangeListener
import android.widget.NumberPicker; //导入方法依赖的package包/类
private NumberPicker.OnValueChangeListener getShengPickerChangeListener() {
return new NumberPicker.OnValueChangeListener() {
@Override
public void onValueChange(NumberPicker numberPicker, int from, int to) {
refreshCitiesPicker(to);
}
};
}
示例3: getShiPickerChangeListener
import android.widget.NumberPicker; //导入方法依赖的package包/类
private NumberPicker.OnValueChangeListener getShiPickerChangeListener() {
return new NumberPicker.OnValueChangeListener() {
@Override
public void onValueChange(NumberPicker numberPicker, int from, int to) {
refreshDistrictPicker(to);
}
};
}
示例4: getQuPickerChangeListener
import android.widget.NumberPicker; //导入方法依赖的package包/类
private NumberPicker.OnValueChangeListener getQuPickerChangeListener() {
return new NumberPicker.OnValueChangeListener() {
@Override
public void onValueChange(NumberPicker numberPicker, int from, int to) {
mCurrentDistrictIndex = to;
}
};
}