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