当前位置: 首页>>代码示例>>Java>>正文


Java NumberPicker.setOnValueChangedListener方法代码示例

本文整理汇总了Java中android.widget.NumberPicker.setOnValueChangedListener方法的典型用法代码示例。如果您正苦于以下问题:Java NumberPicker.setOnValueChangedListener方法的具体用法?Java NumberPicker.setOnValueChangedListener怎么用?Java NumberPicker.setOnValueChangedListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.NumberPicker的用法示例。


在下文中一共展示了NumberPicker.setOnValueChangedListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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

}
 
开发者ID:GrayXu,项目名称:HustEating,代码行数:26,代码来源:SettingFragment.java

示例2: initializeViews

import android.widget.NumberPicker; //导入方法依赖的package包/类
private void initializeViews(Dialog dialog) {
    major = (ToggleButton) dialog.findViewById(R.id.major);
    minor = (ToggleButton) dialog.findViewById(R.id.minor);
    dialog.findViewById(R.id.major_parent).setOnClickListener(__ -> onMajorClicked());
    dialog.findViewById(R.id.minor_parent).setOnClickListener(__ -> onMinorClicked());

    keySigImage = (ImageView) dialog.findViewById(R.id.key_sig_image);

    key = (NumberPicker) dialog.findViewById(R.id.key);
    key.setWrapSelectorWheel(false);
    key.setMinValue(0);
    key.setMaxValue(KeySigHandler.FIFTHS.length - 1);

    major.setChecked(false);
    onMajorClicked();
    key.setOnValueChangedListener(this);
    key.setValue(6);
}
 
开发者ID:joshschriever,项目名称:LiveNotes,代码行数:19,代码来源:KeySigDialogFragment.java

示例3: 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);
}
 
开发者ID:ndleyton,项目名称:OneTwo,代码行数:19,代码来源:ListAdapter.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();

}
 
开发者ID:csarron,项目名称:MobiRNN-EMDL17,代码行数:26,代码来源:PhoneActivity.java

示例5: setupSecondPicker

import android.widget.NumberPicker; //导入方法依赖的package包/类
/**
 * Set the reference of seconds picker, its digit format and register value change listener.
 *
 * @param pickerVisible if false, removes the spinner widget.
 */
@TargetApi(11)
protected void setupSecondPicker(boolean pickerVisible) {
    mSecondPicker = (NumberPicker) findViewById(R.id.seconds);
    if (pickerVisible) {
        mSecondPicker.setMinValue(0);
        mSecondPicker.setMaxValue(59);
        mSecondPicker.setFormatter(TWO_DIGIT_FORMATTER);
        mSecondPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
            @Override
            public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
                mCurrentSecond = newVal;
            }
        });
    } else {
        mHourPicker.setVisibility(View.GONE);
    }
}
 
开发者ID:ChessCom,项目名称:android-chessclock,代码行数:23,代码来源:TimePickerView.java

示例6: setupMinutePicker

import android.widget.NumberPicker; //导入方法依赖的package包/类
/**
 * Set the reference of minute picker, its digit format and register value change listener.
 *
 * @param pickerVisible if false, removes the spinner widget.
 */
@TargetApi(11)
protected void setupMinutePicker(boolean pickerVisible) {
    mMinutePicker = (NumberPicker) findViewById(R.id.minute);
    if (pickerVisible) {
        mMinutePicker.setMinValue(0);
        mMinutePicker.setMaxValue(59);
        mMinutePicker.setFormatter(TWO_DIGIT_FORMATTER);
        mMinutePicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
            @Override
            public void onValueChange(NumberPicker spinner, int oldVal, int newVal) {
                mCurrentMinute = newVal;
            }
        });
    } else {
        mMinutePicker.setVisibility(View.GONE);
        findViewById(R.id.minute_divider).setVisibility(View.GONE);
    }
}
 
开发者ID:ChessCom,项目名称:android-chessclock,代码行数:24,代码来源:TimePickerView.java

示例7: setupHourPicker

import android.widget.NumberPicker; //导入方法依赖的package包/类
/**
 * Set the reference of hour picker, its digit format and register value change listener.
 *
 * @param pickerVisible if false, removes the spinner widget.
 */
@TargetApi(11)
protected void setupHourPicker(boolean pickerVisible) {

    mHourPicker = (NumberPicker) findViewById(R.id.hour);
    if (pickerVisible) {
        mHourPicker.setMinValue(0);
        mHourPicker.setMaxValue(10);
        mHourPicker.setFormatter(TWO_DIGIT_FORMATTER);
        mHourPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
            @Override
            public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
                mCurrentHour = newVal;
            }
        });
    } else {
        mHourPicker.setVisibility(View.GONE);
        findViewById(R.id.hour_divider).setVisibility(View.GONE);
    }
}
 
开发者ID:ChessCom,项目名称:android-chessclock,代码行数:25,代码来源:TimePickerView.java

示例8: 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);
}
 
开发者ID:fengyanjava,项目名称:msb-android,代码行数:19,代码来源:SelectCityDialogV11.java

示例9: init

import android.widget.NumberPicker; //导入方法依赖的package包/类
private void init() {
    inflate(getContext(), R.layout.stage_select_view, this);

    if (!isInEditMode()) {
        MainApplication.from(getContext()).getGraph().inject(this);

        npStage = (NumberPicker) findViewById(R.id.npStage);
        npDay = (NumberPicker) findViewById(R.id.npDay);
        npHour = (NumberPicker) findViewById(R.id.npHour);

        npStage.setMinValue(1);
        npStage.setMaxValue(5);

        npDay.setMinValue(1);
        npDay.setMaxValue(7);

        npHour.setMinValue(1);
        npHour.setMaxValue(23);

        npStage.setOnValueChangedListener(valueChangeListener);
        npDay.setOnValueChangedListener(valueChangeListener);
        npHour.setOnValueChangedListener(valueChangeListener);

        findViewById(R.id.btnSetStageAsCurrentStage).setOnClickListener(buttonClickListener);
    }
}
 
开发者ID:coderswithoutborders,项目名称:deglancer,代码行数:27,代码来源:StageSelectView.java

示例10: 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);

}
 
开发者ID:Knockathon2017,项目名称:knockathon-scripts-kiddies,代码行数:18,代码来源:LanguageSelectionActivity.java

示例11: 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;
}
 
开发者ID:LyndonChin,项目名称:AndroidAreaPicker,代码行数:19,代码来源:AreaPicker.java

示例12: init

import android.widget.NumberPicker; //导入方法依赖的package包/类
void init() {
    custom = true;
    View v = findViewById(R.id.time_sleep_pickers);
    v.setVisibility(View.VISIBLE);

    tHour = (TextView) findViewById(R.id.time_sleep_custom_num_left_t);
    tMinute = (TextView) findViewById(R.id.time_sleep_custom_num_right_t);
    minute = (NumberPicker) findViewById(R.id.time_sleep_custom_num_right);
    hour = (NumberPicker) findViewById(R.id.time_sleep_custom_num_left);
    minute.setOnValueChangedListener(this);
    hour.setOnValueChangedListener(this);

    initTheme();
    initPickersData();
}
 
开发者ID:DuanJiaNing,项目名称:Musicoco,代码行数:16,代码来源:TimeSleepActivity.java

示例13: setupNpbpm

import android.widget.NumberPicker; //导入方法依赖的package包/类
private void setupNpbpm()
{
    npbpm=(NumberPicker)findViewById(R.id.npbpm);
    npbpm.setMinValue(30);
    npbpm.setMaxValue(500);
    npbpm.setWrapSelectorWheel(true);
    npbpm.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
        @Override public void onValueChange(NumberPicker npk, int oldVal, int newVal) {
            setParameters();
            metr.restartIfPlaying();
        }
    });
}
 
开发者ID:JosielSantos,项目名称:android-metronome,代码行数:14,代码来源:Metronome.java

示例14: 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_complex_periodic_care, container, false);
    this.container = (LinearLayout) view;
    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);
    goalPicker.setMaxValue(Integer.MAX_VALUE);
    goalPicker.setMinValue(1);
    goalPicker.setWrapSelectorWheel(false);
    subGoalPicker.setMaxValue(Integer.MAX_VALUE);
    subGoalPicker.setMinValue(2);
    subGoalPicker.setWrapSelectorWheel(false);
    subGoalPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
        @Override
        public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
            if (newVal - oldVal > 0) {
                addTimeLimitationPicker();
            } else {
                new Handler().post(new Runnable() {
                    @Override
                    public void run() {
                        removeTimeLimitationPicker();
                    }
                });
            }
        }
    });
    punishmentPicker.setMaxValue(Integer.MAX_VALUE);
    punishmentPicker.setMinValue(0);
    punishmentPicker.setValue(1);
    punishmentPicker.setWrapSelectorWheel(false);
    timeLimitationPickers = new ArrayList<>();
    addTimeLimitationPicker();
    addTimeLimitationPicker();
    return view;
}
 
开发者ID:OneCivilization,项目名称:MyWorld,代码行数:39,代码来源:NewComplexPeriodicCareFragment.java

示例15: 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);
}
 
开发者ID:farkam135,项目名称:GoIV,代码行数:14,代码来源:MainActivity.java


注:本文中的android.widget.NumberPicker.setOnValueChangedListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。