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


Java NumberPicker.setDisplayedValues方法代码示例

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


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

示例1: onCreate

import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_study_mode_settings_page);

    biologyButton = (ToggleButton) findViewById(R.id.biologyButton);
    chemistryButton = (ToggleButton) findViewById(R.id.chemistryButton);
    earthAndSpaceButton = (ToggleButton) findViewById(R.id.earthAndSpaceButton);
    energyButton = (ToggleButton) findViewById(R.id.energyButton);
    mathButton = (ToggleButton) findViewById(R.id.mathButton);
    physicsButton = (ToggleButton) findViewById(R.id.physicsButton);
    randomButton = (ToggleButton) findViewById(R.id.randomButton);

    roundNumPicker = (NumberPicker) findViewById(R.id.roundNumPicker);
    roundNumPicker.setMinValue(0);
    roundNumPicker.setMaxValue(roundOptions.length-1);
    roundNumPicker.setWrapSelectorWheel(false);
    roundNumPicker.setDisplayedValues(roundOptions);

    menuButton = (Button) findViewById(R.id.menuButton);
}
 
开发者ID:jakepolatty,项目名称:HighSchoolScienceBowlPractice-Android,代码行数:22,代码来源:StudyModeSettingsPage.java

示例2: onCreate

import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_age);
    final EditText ageEdit = (EditText) findViewById(R.id.age);

    ageEdit.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
                hideKeyboard(v);
                ageEdit.setCursorVisible(false);
            } else {
                showKeyboard(v);
                ageEdit.setCursorVisible(true);
            }
        }
    });

    NumberPicker numberPicker = (NumberPicker) findViewById(R.id.numberPicker);
    numberPicker.setMaxValue(28);
    numberPicker.setMinValue(1);

    NumberPicker stringPicker = (NumberPicker) findViewById(R.id.stringPicker);
    stringPicker.setMaxValue(2);
    stringPicker.setMinValue(0);
    stringPicker.setDisplayedValues( new String[] { "Days", "Months", "Years" } );

}
 
开发者ID:smajko,项目名称:what_are_those_app,代码行数:30,代码来源:AgeScreen.java

示例3: onCreate

import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reader_mode_settings_page);

    setNumPicker = (NumberPicker) findViewById(R.id.setNumPicker);
    setNumPicker.setMinValue(0);
    setNumPicker.setMaxValue(setOptions.length-1);
    setNumPicker.setWrapSelectorWheel(false);
    setNumPicker.setDisplayedValues(setOptions);

    roundNumPicker = (NumberPicker) findViewById(R.id.roundNumPicker);
    roundNumPicker.setMinValue(0);
    roundNumPicker.setMaxValue(roundOptions.length-1);
    roundNumPicker.setWrapSelectorWheel(false);
    roundNumPicker.setDisplayedValues(roundOptions);

    tossupTimeSpinner = (Spinner) findViewById(R.id.tossupTimeSelector);
    bonusTimeSpinner = (Spinner) findViewById(R.id.bonusTimeSelector);

    menuButton = (Button) findViewById(R.id.menuButton);
}
 
开发者ID:jakepolatty,项目名称:HighSchoolScienceBowlPractice-Android,代码行数:23,代码来源:ReaderModeSettingsPage.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: 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_periodic_care, container, false);
    goalPicker = (NumberPicker) view.findViewById(R.id.goal_picker);
    punishmentPicker = (NumberPicker) view.findViewById(R.id.punishment_picker);
    lengthPicker = (NumberPicker) view.findViewById(R.id.length_picker);
    unitPicker = (NumberPicker) view.findViewById(R.id.unit_picker);
    goalPicker.setMaxValue(Integer.MAX_VALUE);
    goalPicker.setMinValue(1);
    goalPicker.setWrapSelectorWheel(false);
    punishmentPicker.setMaxValue(Integer.MAX_VALUE);
    punishmentPicker.setMinValue(0);
    punishmentPicker.setValue(1);
    punishmentPicker.setWrapSelectorWheel(false);
    lengthPicker.setMaxValue(Integer.MAX_VALUE);
    lengthPicker.setMinValue(1);
    lengthPicker.setWrapSelectorWheel(false);
    unitPicker.setDisplayedValues(getResources().getStringArray(R.array.period_units));
    unitPicker.setMaxValue(3);
    unitPicker.setMinValue(0);
    unitPicker.setValue(3);
    unitPicker.setWrapSelectorWheel(true);
    return view;
}
 
开发者ID:OneCivilization,项目名称:MyWorld,代码行数:26,代码来源:NewPeriodicCareFragment.java

示例6: SetSnoozePickerValues

import android.widget.NumberPicker; //导入方法依赖的package包/类
static void SetSnoozePickerValues(NumberPicker picker, boolean above, int default_snooze) {
    String[] values=new String[snoozeValues.length];
    for(int i=0;i<values.length;i++){
        values[i]=getNameFromTime(snoozeValues[i]);
    }

    picker.setMaxValue(values.length -1);
    picker.setMinValue(0);
    picker.setDisplayedValues(values);
    picker.setWrapSelectorWheel(false);
    if(default_snooze != 0) {
        picker.setValue(getSnoozeLocatoin(default_snooze));
    } else {
        picker.setValue(getSnoozeLocatoin(getDefaultSnooze(above)));
    }
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:17,代码来源:SnoozeActivity.java

示例7: 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

示例8: 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

示例9: 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

示例10: setUpMinutePicker

import android.widget.NumberPicker; //导入方法依赖的package包/类
protected void setUpMinutePicker(View view) {
    minutePicker = (NumberPicker) view.findViewById(R.id.picker1);
    minutePicker.setMaxValue(MAX_VALUE);
    minutePicker.setMinValue(MIN_VALUE);
    minutePicker.setValue(sharedPreferences.getInt("nagMinutes", getContext().getResources().getInteger(R.integer.default_nag_minutes)));

    String[] minuteValues = new String[61];
    for (int i = 0; i < minuteValues.length; i++) {
        minuteValues[i] = String.format(getContext().getResources().getQuantityString(R.plurals.time_minute, i), i);
    }
    minutePicker.setDisplayedValues(minuteValues);
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:13,代码来源:PreferenceNagTimePicker.java

示例11: setUpSecondPicker

import android.widget.NumberPicker; //导入方法依赖的package包/类
protected void setUpSecondPicker(View view) {
    secondPicker = (NumberPicker) view.findViewById(R.id.picker2);
    secondPicker.setMaxValue(MAX_VALUE);
    secondPicker.setMinValue(MIN_VALUE);
    secondPicker.setValue(sharedPreferences.getInt("nagSeconds", getContext().getResources().getInteger(R.integer.default_nag_seconds)));

    String[] secondValues = new String[61];
    for (int i = 0; i < secondValues.length; i++) {
        secondValues[i] = String.format(getContext().getResources().getQuantityString(R.plurals.time_second, i), i);
    }
    secondPicker.setDisplayedValues(secondValues);
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:13,代码来源:PreferenceNagTimePicker.java

示例12: 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_subperiodic_care, container, false);
    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);
    lengthPicker = (NumberPicker) view.findViewById(R.id.length_picker);
    unitPicker = (NumberPicker) view.findViewById(R.id.unit_picker);
    goalPicker.setMaxValue(Integer.MAX_VALUE);
    goalPicker.setMinValue(1);
    goalPicker.setWrapSelectorWheel(false);
    subGoalPicker.setMaxValue(Integer.MAX_VALUE);
    subGoalPicker.setMinValue(2);
    subGoalPicker.setWrapSelectorWheel(false);
    punishmentPicker.setMaxValue(Integer.MAX_VALUE);
    punishmentPicker.setMinValue(0);
    punishmentPicker.setValue(1);
    punishmentPicker.setWrapSelectorWheel(false);
    lengthPicker.setMaxValue(Integer.MAX_VALUE);
    lengthPicker.setMinValue(1);
    lengthPicker.setWrapSelectorWheel(false);
    unitPicker.setDisplayedValues(getResources().getStringArray(R.array.period_units));
    unitPicker.setMaxValue(3);
    unitPicker.setMinValue(0);
    unitPicker.setValue(3);
    unitPicker.setWrapSelectorWheel(true);
    return view;
}
 
开发者ID:OneCivilization,项目名称:MyWorld,代码行数:30,代码来源:NewSubPeriodicCareFragment.java

示例13: showDialog

import android.widget.NumberPicker; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void showDialog() {
    if (mDialog == null) {

        View view = ((LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.view_number_picker_dialog, null);

        // build NumberPicker
        mPicker = (NumberPicker) view.findViewById(R.id.number_picker);
        if (mStep > 1) {
            mValues = new String[(mMax - mMin) / mStep + 1];
            for (int i = 0; i < mValues.length; i++) {
                mValues[i] = Integer.toString(mMin + mStep * i);
            }
            mPicker.setMinValue(0);
            mPicker.setMaxValue((mMax - mMin) / mStep);
            mPicker.setDisplayedValues(mValues);
        } else {
            mPicker.setMaxValue(mMax);
            mPicker.setMinValue(mMin);
            mPicker.setValue(mCurrentValue);
        }

        // build save button
        Button saveButton = (Button) view.findViewById(R.id.btn_save);
        saveButton.setOnClickListener(this);

        // build dialog
        mDialog = new AlertDialog.Builder(getContext())
                .setTitle(mTitle)
                .setView(view)
                .setCancelable(true)
                .create();

        mDialog.setCanceledOnTouchOutside(true);
    }

    mDialog.show();
}
 
开发者ID:theblixguy,项目名称:ForceDoze,代码行数:39,代码来源:NumberPickerPreference.java

示例14: initPickerData

import android.widget.NumberPicker; //导入方法依赖的package包/类
private void initPickerData(NumberPicker picker, String[] data) {
    if(data == null || data.length < 1) return;

    picker.setDisplayedValues(null);
    picker.setMinValue(0);
    picker.setMaxValue(data.length - 1);
    picker.setWrapSelectorWheel(false);
    picker.setDisplayedValues(data);
}
 
开发者ID:h3clikejava,项目名称:android-shengshiqu,代码行数:10,代码来源:ShengShiQuPicker.java

示例15: onCreateDialogView

import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected View onCreateDialogView() {
   prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
   numberPicker = new NumberPicker(getContext());
   numberPicker.setMinValue(minValue);
   numberPicker.setMaxValue(maxValue);
   String[] displayedValues =new String[maxValue-minValue+1];
   for(int i=minValue;i<=maxValue;i++){
      displayedValues[i-minValue]=Integer.toString(i*multiplier);
   }
   numberPicker.setDisplayedValues(displayedValues);
   numberPicker.setValue(prefs.getInt(pref_key, defaultDisplayValue)/multiplier);
   return numberPicker;
}
 
开发者ID:safesoftware,项目名称:fme-apps-android,代码行数:15,代码来源:CustomNumberPicker.java


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