當前位置: 首頁>>代碼示例>>Java>>正文


Java NumberPicker.setValue方法代碼示例

本文整理匯總了Java中android.widget.NumberPicker.setValue方法的典型用法代碼示例。如果您正苦於以下問題:Java NumberPicker.setValue方法的具體用法?Java NumberPicker.setValue怎麽用?Java NumberPicker.setValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.NumberPicker的用法示例。


在下文中一共展示了NumberPicker.setValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onHeightClick

import android.widget.NumberPicker; //導入方法依賴的package包/類
@OnClick(R.id.custom_tile_height_size)
public void onHeightClick() {
  final NumberPicker view = new NumberPicker(this);
  view.setMinValue(24);
  view.setMaxValue(64);
  view.setWrapSelectorWheel(false);
  view.setValue(currentTileHeight);
  new AlertDialog.Builder(this)
          .setView(view)
          .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(@NonNull DialogInterface dialog, int which) {
              currentTileHeight = view.getValue();
              widget.setTileHeightDp(currentTileHeight);
            }
          })
          .show();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:CustomTileDimensions.java

示例2: playerNumberAlert

import android.widget.NumberPicker; //導入方法依賴的package包/類
@SuppressWarnings("SameParameterValue")
private void playerNumberAlert(String title, final String preferenceName, int min, int max, int default_num) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    View mView = inflater.inflate(R.layout.dialog_number_picker, (ViewGroup) getActivity().findViewById(R.id.dialog_layout_number_picker));
    final NumberPicker numberPicker = mView.findViewById(R.id.dialog_number_picker);
    numberPicker.setMinValue(min);
    numberPicker.setMaxValue(max);
    numberPicker.setValue(default_num);
    builder.setTitle(title);
    builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            sharedPreferences.edit().putInt(preferenceName, numberPicker.getValue()).apply();
        }
    });
    builder.setNegativeButton(android.R.string.no, null);
    builder.setView(mView);
    builder.show();
}
 
開發者ID:XFY9326,項目名稱:CatchSpy,代碼行數:21,代碼來源:GlobalSettingsFragment.java

示例3: onWidthClick

import android.widget.NumberPicker; //導入方法依賴的package包/類
@OnClick(R.id.custom_tile_width_size)
public void onWidthClick() {
  final NumberPicker view = new NumberPicker(this);
  view.setMinValue(24);
  view.setMaxValue(64);
  view.setWrapSelectorWheel(false);
  view.setValue(currentTileWidth);
  new AlertDialog.Builder(this)
          .setView(view)
          .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(@NonNull DialogInterface dialog, int which) {
              currentTileWidth = view.getValue();
              widget.setTileWidthDp(currentTileWidth);
            }
          })
          .show();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:CustomTileDimensions.java

示例4: onTileSizeClicked

import android.widget.NumberPicker; //導入方法依賴的package包/類
@OnClick(R.id.button_set_tile_size)
void onTileSizeClicked() {
    final NumberPicker view = new NumberPicker(this);
    view.setMinValue(24);
    view.setMaxValue(64);
    view.setWrapSelectorWheel(false);
    view.setValue(currentTileSize);
    new AlertDialog.Builder(this)
            .setView(view)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(@NonNull DialogInterface dialog, int which) {
                    currentTileSize = view.getValue();
                    widget.setTileSizeDp(currentTileSize);
                }
            })
            .show();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:DynamicSettersActivity.java

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

示例6: onViewCreated

import android.widget.NumberPicker; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    //mConversationView = (ListView) view.findViewById(R.id.in);
    mStartButton = (Button) view.findViewById(R.id.button_start);
    mStopButton = (Button) view.findViewById(R.id.button_stop);
    mDisconnectButton = (Button) view.findViewById(R.id.button_disconnect);
    mLevel = (NumberPicker) view.findViewById(R.id.Level);
    mLevel.setMaxValue(32);
    mLevel.setMinValue(1);
    mLevel.setValue(1);
    mLevel.setWrapSelectorWheel(false);
    mLevel.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
    mSpeedText = (TextView) view.findViewById(R.id.Speed);
    mPowerText = (TextView) view.findViewById(R.id.Power);
    mRPMText = (TextView) view.findViewById(R.id.RPM);
    mDistanceText = (TextView) view.findViewById(R.id.Distance);
    mCaloriesText = (TextView) view.findViewById(R.id.Calories);
    mHFText = (TextView) view.findViewById(R.id.Heart);
    mTimeText = (TextView) view.findViewById(R.id.Time);
}
 
開發者ID:haraldh,項目名稱:iconsole-android,代碼行數:21,代碼來源:BluetoothChatFragment.java

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

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

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

示例11: showNumPick

import android.widget.NumberPicker; //導入方法依賴的package包/類
/** 彈出數字選擇器 **/
private void showNumPick() {
	final NumberPicker picker = new NumberPicker(getActivity());
	picker.setMinValue(0);
	picker.setMaxValue(200);
	picker.setValue(mMinTime);
	new AlertDialog.Builder(getActivity()).setView(picker)
		.setPositiveButton(getResources().getString(R.string.ok), new OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				mMinTime = picker.getValue();
				tv_min_time.setText(getResources().getString(R.string.search_min_time, mMinTime));
			}
		}).show();
}
 
開發者ID:wangcantian,項目名稱:Mobile-Office,代碼行數:17,代碼來源:MeetingFragment.java

示例12: onBindDialogView

import android.widget.NumberPicker; //導入方法依賴的package包/類
@Override
protected void onBindDialogView(View view) {
    NumberPickerPreference preference = getNumberPickerPreference();

    numberPicker = (NumberPicker) view.findViewById(R.id.numberpicker);
    numberPicker.setMinValue(preference.getMinValue());
    numberPicker.setMaxValue(preference.getMaxValue());
    numberPicker.setValue(restoredState ? restoredValue : preference.getValue());
    if (preference.getDescendantFocusability() > 0) {
        //noinspection ResourceType
        numberPicker.setDescendantFocusability(preference.getDescendantFocusability());
    }
    numberPicker.setWrapSelectorWheel(preference.isWrapSelectorWheel());

    TextView textView = (TextView) view.findViewById(R.id.subtitle);
    textView.setText(preference.getSubtitleText());
}
 
開發者ID:vinexs,項目名稱:extend-enhance-base,代碼行數:18,代碼來源:NumberPickerPreferenceDialogFragmentCompat.java

示例13: onBindDialogView

import android.widget.NumberPicker; //導入方法依賴的package包/類
/**
 * Perform initialization of the view items
 */
@Override
protected void onBindDialogView(View view) {
    super.onBindDialogView(view);

    // Obtain the current value
    long currentValue = Long.valueOf(getPersistedString(
            getContext().getString(R.string.pref_interval_default)));
    Interval interval = getInterval(currentValue);

    // Obtain references to the pickers and initialize them with the correct value
    mHourPicker = (NumberPicker) view.findViewById(R.id.hourPicker);
    mHourPicker.setMinValue(0);
    mHourPicker.setMaxValue(23);
    mHourPicker.setValue(interval.mHours);

    mMinutePicker = (NumberPicker) view.findViewById(R.id.minutePicker);
    mMinutePicker.setMinValue(0);
    mMinutePicker.setMaxValue(59);
    mMinutePicker.setValue(interval.mMinutes);

    mSecondPicker = (NumberPicker) view.findViewById(R.id.secondPicker);
    mSecondPicker.setMinValue(0);
    mSecondPicker.setMaxValue(59);
    mSecondPicker.setValue(interval.mSeconds);
}
 
開發者ID:nathan-osman,項目名稱:chronosnap,代碼行數:29,代碼來源:TimeIntervalPreference.java

示例14: onPrepareDialogBuilder

import android.widget.NumberPicker; //導入方法依賴的package包/類
@Override
protected void onPrepareDialogBuilder(final Builder builder) {
    super.onPrepareDialogBuilder(builder);
    mNumberPicker = new NumberPicker(getContext());
    mNumberPicker.setMinValue(mMinValue);
    mNumberPicker.setMaxValue(mMaxValue);
    mNumberPicker.setValue(mSelectedValue);
    mNumberPicker.setWrapSelectorWheel(mWrapSelectorWheel);
    mNumberPicker.setLayoutParams(new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    for (int i = 0; i < mNumberPicker.getChildCount(); i++) {
        View v = mNumberPicker.getChildAt(i);
        if (v instanceof EditText) {
            v.setOnKeyListener(new KeyListener());
        }
    }
    final LinearLayout linearLayout = new LinearLayout(this.getContext());
    linearLayout.setLayoutParams(new LinearLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    linearLayout.setGravity(Gravity.CENTER);
    linearLayout.addView(mNumberPicker);

    builder.setView(linearLayout);
}
 
開發者ID:JackWink,項目名稱:tweakable,代碼行數:26,代碼來源:NumberPickerPreference.java

示例15: changePlayerCount

import android.widget.NumberPicker; //導入方法依賴的package包/類
@OnClick({R.id.player_count_value, R.id.player_count_description})
public void changePlayerCount() {
	View numberPickerLayout = getLayoutInflater().inflate(R.layout.dialog_number_picker, null);
	final NumberPicker numberPicker = (NumberPicker) numberPickerLayout.findViewById(R.id.number_picker);
	numberPicker.setValue(Integer.valueOf(playerCountValue.getText().toString()));
	numberPicker.setMinValue(2);
	numberPicker.setMaxValue(100);
	numberPicker.setWrapSelectorWheel(false);
	numberPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
       final TextView playersTextView = (TextView) numberPickerLayout.findViewById(R.id
               .number_picker_text);
       playersTextView.setText(R.string.activity_host_game_players_count_players);

	new AlertDialog.Builder(this)
			.setView(numberPickerLayout)
			.setTitle(R.string.activity_host_game_players_count_title)
			.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
				@Override
				public void onClick(DialogInterface dialog, int which) {
					playerCountValue.setText(String.valueOf(numberPicker.getValue()));
				}
			})
			.setNegativeButton(android.R.string.cancel, null)
			.show();
}
 
開發者ID:FauDroids,項目名稱:FlippyPairs,代碼行數:26,代碼來源:HostGameActivity.java


注:本文中的android.widget.NumberPicker.setValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。