NumberPicker setWrapSelectorWheel - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for NumberPicker setWrapSelectorWheel method.

This code example shows how to use the following methods:setDisplayedValues, setMaxValue, setMinValue, setValue, setWrapSelectorWheel
 
    /** 
     * This method should be subclassed to update the spinners based on mCurrentDate. 
     */ 
    protected void updateSpinners() { 
        mPositionInYearSpinner.setDisplayedValues(null);
 
        // set the spinner ranges respecting the min and max dates 
        mPositionInYearSpinner.setMinValue(getMinPositionInYear());
        mPositionInYearSpinner.setMaxValue(getMaxPositionInYear());
        mPositionInYearSpinner.setWrapSelectorWheel(
                !mCurrentDate.equals(mMinDate) && !mCurrentDate.equals(mMaxDate));
 
        // year spinner range does not change based on the current date 
        mYearSpinner.setMinValue(getMinYear());
        mYearSpinner.setMaxValue(getMaxYear());
        mYearSpinner.setWrapSelectorWheel(false);
 
        // set the spinner values 
        mYearSpinner.setValue(getYear());

7
CodeRank
This code example shows how to use the following methods:setFocusable, setFocusableInTouchMode, setLayoutParams, setFormatter, setMaxValue
     * @return NumberPicker The that represents the number picker 
     */ 
    private NumberPicker createNumberPicker(
            int maxValue, TextView toAlignWith, TextView toHeightOf, final String format) {
        // Create the NumberPicker 
        NumberPicker digit = new NumberPicker(getContext());
        LayoutParams params = new RelativeLayout.LayoutParams(
                android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
        params.addRule(RelativeLayout.ALIGN_LEFT, toAlignWith.getId());
        params.addRule(RelativeLayout.ALIGN_RIGHT, toAlignWith.getId());
        params.addRule(RelativeLayout.ALIGN_TOP, toHeightOf.getId());
        params.addRule(RelativeLayout.ALIGN_BOTTOM, toHeightOf.getId());
        digit.setLayoutParams(params);
        digit.setMinValue(0);
        digit.setMaxValue(maxValue);
        digit.setValue(0);
        digit.setWrapSelectorWheel(false);
        digit.setFocusable(false);
        digit.setFocusableInTouchMode(false);

6
CodeRank
This code example shows how to use the following methods:getMaxValue, getMinValue, setDisplayedValues, setMaxValue, setMinValue
This code example shows how to use the following methods:setDisplayedValues, setMaxValue, setMinValue, setValue, setWrapSelectorWheel
 
    /** 
     * This method should be subclassed to update the spinners based on mCurrentDate. 
     */ 
    protected void updateSpinners() { 
        mPositionInYearSpinner.setDisplayedValues(null);
 
        // set the spinner ranges respecting the min and max dates 
        mPositionInYearSpinner.setMinValue(getMinPositionInYear());
        mPositionInYearSpinner.setMaxValue(getMaxPositionInYear());
        mPositionInYearSpinner.setWrapSelectorWheel(
                !mCurrentDate.equals(mMinDate) && !mCurrentDate.equals(mMaxDate));
 
        // year spinner range does not change based on the current date 
        mYearSpinner.setMinValue(getMinYear());
        mYearSpinner.setMaxValue(getMaxYear());
        mYearSpinner.setWrapSelectorWheel(false);
 
        // set the spinner values 
        mYearSpinner.setValue(getYear());

6
CodeRank
This code example shows how to use the following methods:setEnabled, setMaxValue, setMinValue, setValue, setWrapSelectorWheel
	public int initializeStuff() { 
		int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
		 
		npHeadphone.setMaxValue(maxVolume);
		npHeadphone.setMinValue(1);
		npSpeaker.setMaxValue(maxVolume);
		npSpeaker.setMinValue(1);
		npHeadphone.setWrapSelectorWheel(false);
		npSpeaker.setWrapSelectorWheel(false);
		 
		npHeadphone.setValue(maxVolume/2); //initalize value in the picker
		npSpeaker.setValue(maxVolume/2);
		 
		//npHeadphone.setEnabled(false); //disable changes for headphone on initialization 
		npSpeaker.setEnabled(false);
		 
		return maxVolume;
		 
	} 
	 
6
CodeRank
This code example shows how to use the following methods:setDescendantFocusability, setFormatter, setMaxValue, setMinValue, setValue
    // On create dialog view 
 
    @Override 
    protected View onCreateDialogView()
    { 
	mPicker = new NumberPicker(getContext());
 
	mPicker.setMaxValue(mMaxValue);
	mPicker.setMinValue(mMinValue);
	mPicker.setValue(mValue);
 
	mPicker.setFormatter(new NumberPicker.Formatter()
	    { 
		@SuppressLint("DefaultLocale") 
		@Override 
		public String format(int value)
		{ 
		    return String.format("%dHz", value);
		} 
	    }); 

6
CodeRank
This code example shows how to use the following methods:getMaxValue, getMinValue, setDisplayedValues, setMaxValue, setMinValue
5
CodeRank
This code example shows how to use the following methods:getMaxValue, getMinValue, setDisplayedValues, setMaxValue, setMinValue
5
CodeRank

Related NumberPicker setWrapSelectorWheel Questions & Answers:

setWrapSelectorWheel Method Overview
Sets whether the selector wheel shown during flinging/scrolling should wrap around the getMinValue() and getMaxValue() values.
See Code Examples for other Android NumberPicker Methods: