本文整理匯總了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;
}
};
}