本文整理汇总了Java中android.widget.NumberPicker.setOnScrollListener方法的典型用法代码示例。如果您正苦于以下问题:Java NumberPicker.setOnScrollListener方法的具体用法?Java NumberPicker.setOnScrollListener怎么用?Java NumberPicker.setOnScrollListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.NumberPicker
的用法示例。
在下文中一共展示了NumberPicker.setOnScrollListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initNumPicker
import android.widget.NumberPicker; //导入方法依赖的package包/类
/**
* 初始化传入的moneyPicker
*
* @param numberPickerArrayList 需要初始化的NumPicker
*/
private void initNumPicker(ArrayList<NumberPicker> numberPickerArrayList) {
Iterator iterator = numberPickerArrayList.iterator();
while (iterator.hasNext()) {
NumberPicker moneyPicker = (NumberPicker) iterator.next();
moneyPicker.setFormatter(this);
moneyPicker.setOnValueChangedListener(this);
moneyPicker.setOnScrollListener(this);
moneyPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
}
numberPickerArrayList.get(0).setMinValue(3);numberPickerArrayList.get(0).setMaxValue(15);//早餐的价格区间
numberPickerArrayList.get(1).setMinValue(5);numberPickerArrayList.get(1).setMaxValue(30);//午餐的价格区间
numberPickerArrayList.get(2).setMinValue(5);numberPickerArrayList.get(2).setMaxValue(30);//晚餐的价格区间
numberPickerArrayList.get(0).setValue(preferences.getInt("moneyBreakfastChosen", 5));//早餐默认为5
numberPickerArrayList.get(1).setValue(preferences.getInt("moneyLunchChosen", 10));//午饭默认为10
numberPickerArrayList.get(2).setValue(preferences.getInt("moneyDinnerChosen", 12));//早餐默认为12
}
示例2: ListAdapterViewHolder
import android.widget.NumberPicker; //导入方法依赖的package包/类
public ListAdapterViewHolder(View view) {
super(view);
mTextView = (TextView) view.findViewById(R.id.tv_object_data);
removeButton = (Button) view.findViewById(R.id.remove_button);
numberPicker = (NumberPicker) view.findViewById(R.id.number_picker);
numberPicker.setMaxValue(99999);
numberPicker.setMinValue(0);
numberPicker.setOnScrollListener(this);
numberPicker.setOnValueChangedListener(this);
numberPicker.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
v.performClick();
return true;
}
});
view.setOnClickListener(this);
}
示例3: initiateLevelPicker
import android.widget.NumberPicker; //导入方法依赖的package包/类
/**
* Initiates the scrollable level picker.
*/
private void initiateLevelPicker() {
npTrainerLevel = (NumberPicker) findViewById(R.id.trainerLevel);
npTrainerLevel.setMaxValue(40);
npTrainerLevel.setMinValue(1);
npTrainerLevel.setWrapSelectorWheel(false);
npTrainerLevel.setValue(trainerLevel);
npTrainerLevel.setOnScrollListener(npTrainerLevelPickerListenerInstance);
npTrainerLevel.setOnValueChangedListener(npTrainerLevelPickerListenerInstance);
}