Loading api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -56691,6 +56691,8 @@ package android.widget { method public int getMaxValue(); method public int getMinValue(); method public int getSelectionDividerHeight(); method @ColorInt public int getTextColor(); method @FloatRange(from=0.0, fromInclusive=false) public float getTextSize(); method public int getValue(); method public boolean getWrapSelectorWheel(); method public void setDisplayedValues(String[]); Loading @@ -56701,6 +56703,8 @@ package android.widget { method public void setOnScrollListener(android.widget.NumberPicker.OnScrollListener); method public void setOnValueChangedListener(android.widget.NumberPicker.OnValueChangeListener); method public void setSelectionDividerHeight(@IntRange(from=0) @Px int); method public void setTextColor(@ColorInt int); method public void setTextSize(@FloatRange(from=0.0, fromInclusive=false) float); method public void setValue(int); method public void setWrapSelectorWheel(boolean); } core/java/android/widget/NumberPicker.java +41 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package android.widget; import android.annotation.CallSuper; import android.annotation.ColorInt; import android.annotation.FloatRange; import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.Px; Loading Loading @@ -340,7 +342,7 @@ public class NumberPicker extends LinearLayout { /** * The {@link Paint} for drawing the selector. */ @UnsupportedAppUsage @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) private final Paint mSelectorWheelPaint; /** Loading Loading @@ -1717,6 +1719,44 @@ public class NumberPicker extends LinearLayout { return mAccessibilityNodeProvider; } /** * Sets the text color for all the states (normal, selected, focused) to be the given color. * * @param color A color value in the form 0xAARRGGBB. */ public void setTextColor(@ColorInt int color) { mSelectorWheelPaint.setColor(color); mInputText.setTextColor(color); invalidate(); } /** * @return the text color. */ @ColorInt public int getTextColor() { return mSelectorWheelPaint.getColor(); } /** * Sets the text size to the given value. This value must be > 0 * * @param size The size in pixel units. */ public void setTextSize(@FloatRange(from = 0.0, fromInclusive = false) float size) { mSelectorWheelPaint.setTextSize(size); mInputText.setTextSize(TypedValue.COMPLEX_UNIT_PX, size); invalidate(); } /** * @return the size (in pixels) of the text size in this NumberPicker. */ @FloatRange(from = 0.0, fromInclusive = false) public float getTextSize() { return mSelectorWheelPaint.getTextSize(); } /** * Makes a measure spec that tries greedily to use the max value. * Loading Loading
api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -56691,6 +56691,8 @@ package android.widget { method public int getMaxValue(); method public int getMinValue(); method public int getSelectionDividerHeight(); method @ColorInt public int getTextColor(); method @FloatRange(from=0.0, fromInclusive=false) public float getTextSize(); method public int getValue(); method public boolean getWrapSelectorWheel(); method public void setDisplayedValues(String[]); Loading @@ -56701,6 +56703,8 @@ package android.widget { method public void setOnScrollListener(android.widget.NumberPicker.OnScrollListener); method public void setOnValueChangedListener(android.widget.NumberPicker.OnValueChangeListener); method public void setSelectionDividerHeight(@IntRange(from=0) @Px int); method public void setTextColor(@ColorInt int); method public void setTextSize(@FloatRange(from=0.0, fromInclusive=false) float); method public void setValue(int); method public void setWrapSelectorWheel(boolean); }
core/java/android/widget/NumberPicker.java +41 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package android.widget; import android.annotation.CallSuper; import android.annotation.ColorInt; import android.annotation.FloatRange; import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.Px; Loading Loading @@ -340,7 +342,7 @@ public class NumberPicker extends LinearLayout { /** * The {@link Paint} for drawing the selector. */ @UnsupportedAppUsage @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) private final Paint mSelectorWheelPaint; /** Loading Loading @@ -1717,6 +1719,44 @@ public class NumberPicker extends LinearLayout { return mAccessibilityNodeProvider; } /** * Sets the text color for all the states (normal, selected, focused) to be the given color. * * @param color A color value in the form 0xAARRGGBB. */ public void setTextColor(@ColorInt int color) { mSelectorWheelPaint.setColor(color); mInputText.setTextColor(color); invalidate(); } /** * @return the text color. */ @ColorInt public int getTextColor() { return mSelectorWheelPaint.getColor(); } /** * Sets the text size to the given value. This value must be > 0 * * @param size The size in pixel units. */ public void setTextSize(@FloatRange(from = 0.0, fromInclusive = false) float size) { mSelectorWheelPaint.setTextSize(size); mInputText.setTextSize(TypedValue.COMPLEX_UNIT_PX, size); invalidate(); } /** * @return the size (in pixels) of the text size in this NumberPicker. */ @FloatRange(from = 0.0, fromInclusive = false) public float getTextSize() { return mSelectorWheelPaint.getTextSize(); } /** * Makes a measure spec that tries greedily to use the max value. * Loading