AI2 Component
(Version nb184)
|
Public Member Functions | |
Slider (ComponentContainer container) | |
void | ThumbEnabled (boolean enabled) |
boolean | ThumbEnabled () |
void | ThumbPosition (float position) |
float | ThumbPosition () |
void | MinValue (float value) |
float | MinValue () |
void | MaxValue (float value) |
float | MaxValue () |
int | ColorLeft () |
void | ColorLeft (int argb) |
int | ColorRight () |
void | ColorRight (int argb) |
View | getView () |
void | onProgressChanged (SeekBar seekBar, int progress, boolean fromUser) |
void | PositionChanged (float thumbPosition) |
void | onStartTrackingTouch (SeekBar seekBar) |
void | onStopTrackingTouch (SeekBar seekBar) |
int | Height () |
void | Height (int height) |
Public Member Functions inherited from com.google.appinventor.components.runtime.AndroidViewComponent | |
boolean | Visible () |
void | Visible (boolean visibility) |
int | Width () |
void | Width (int width) |
void | WidthPercent (int pCent) |
void | setLastWidth (int width) |
int | getSetWidth () |
void | setLastHeight (int height) |
int | getSetHeight () |
void | CopyWidth (AndroidViewComponent sourceComponent) |
void | HeightPercent (int pCent) |
void | CopyHeight (AndroidViewComponent sourceComponent) |
int | Column () |
void | Column (int column) |
int | Row () |
void | Row (int row) |
HandlesEventDispatching | getDispatchDelegate () |
Public Attributes | |
final boolean | referenceGetThumb = (SdkLevel.getLevel() >= SdkLevel.LEVEL_JELLYBEAN) |
Additional Inherited Members | |
Static Public Attributes inherited from com.google.appinventor.components.runtime.Component | |
static final String | ASSET_DIRECTORY = "component" |
static final int | ALIGNMENT_NORMAL = 0 |
static final int | ALIGNMENT_CENTER = 1 |
static final int | ALIGNMENT_OPPOSITE = 2 |
static final int | ACCELEROMETER_SENSITIVITY_WEAK = 1 |
static final int | ACCELEROMETER_SENSITIVITY_MODERATE = 2 |
static final int | ACCELEROMETER_SENSITIVITY_STRONG = 3 |
static final int | BUTTON_SHAPE_DEFAULT = 0 |
static final int | BUTTON_SHAPE_ROUNDED = 1 |
static final int | BUTTON_SHAPE_RECT = 2 |
static final int | BUTTON_SHAPE_OVAL = 3 |
static final int | COLOR_NONE = 0x00FFFFFF |
static final int | COLOR_BLACK = 0xFF000000 |
static final int | COLOR_BLUE = 0xFF0000FF |
static final int | COLOR_CYAN = 0xFF00FFFF |
static final int | COLOR_DKGRAY = 0xFF444444 |
static final int | COLOR_GRAY = 0xFF888888 |
static final int | COLOR_GREEN = 0xFF00FF00 |
static final int | COLOR_LTGRAY = 0xFFCCCCCC |
static final int | COLOR_MAGENTA = 0xFFFF00FF |
static final int | COLOR_ORANGE = 0xFFFFC800 |
static final int | COLOR_PINK = 0xFFFFAFAF |
static final int | COLOR_RED = 0xFFFF0000 |
static final int | COLOR_WHITE = 0xFFFFFFFF |
static final int | COLOR_YELLOW = 0xFFFFFF00 |
static final int | COLOR_DEFAULT = 0x00000000 |
static final String | DEFAULT_VALUE_COLOR_NONE = "&H00FFFFFF" |
static final String | DEFAULT_VALUE_COLOR_BLACK = "&HFF000000" |
static final String | DEFAULT_VALUE_COLOR_BLUE = "&HFF0000FF" |
static final String | DEFAULT_VALUE_COLOR_CYAN = "&HFF00FFFF" |
static final String | DEFAULT_VALUE_COLOR_DKGRAY = "&HFF444444" |
static final String | DEFAULT_VALUE_COLOR_GRAY = "&HFF888888" |
static final String | DEFAULT_VALUE_COLOR_GREEN = "&HFF00FF00" |
static final String | DEFAULT_VALUE_COLOR_LTGRAY = "&HFFCCCCCC" |
static final String | DEFAULT_VALUE_COLOR_MAGENTA = "&HFFFF00FF" |
static final String | DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800" |
static final String | DEFAULT_VALUE_COLOR_PINK = "&HFFFFAFAF" |
static final String | DEFAULT_VALUE_COLOR_RED = "&HFFFF0000" |
static final String | DEFAULT_VALUE_COLOR_WHITE = "&HFFFFFFFF" |
static final String | DEFAULT_VALUE_COLOR_YELLOW = "&HFFFFFF00" |
static final String | DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000" |
static final float | FONT_DEFAULT_SIZE = 14 |
static final int | LAYOUT_ORIENTATION_HORIZONTAL = ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL |
static final int | LAYOUT_ORIENTATION_VERTICAL = ComponentConstants.LAYOUT_ORIENTATION_VERTICAL |
static final int | SCALING_SCALE_PROPORTIONALLY = 0 |
static final int | SCALING_SCALE_TO_FIT = 1 |
static final int | TYPEFACE_DEFAULT = 0 |
static final int | TYPEFACE_SANSSERIF = 1 |
static final int | TYPEFACE_SERIF = 2 |
static final int | TYPEFACE_MONOSPACE = 3 |
static final int | LENGTH_PREFERRED = -1 |
static final int | LENGTH_FILL_PARENT = -2 |
static final int | LENGTH_UNKNOWN = -3 |
static final int | LENGTH_PERCENT_TAG = -1000 |
static final int | TOAST_LENGTH_SHORT = 0 |
static final int | TOAST_LENGTH_LONG = 1 |
static final int | DIRECTION_NORTH = 1 |
static final int | DIRECTION_NORTHEAST = 2 |
static final int | DIRECTION_EAST = 3 |
static final int | DIRECTION_SOUTHEAST = 4 |
static final int | DIRECTION_SOUTH = -1 |
static final int | DIRECTION_SOUTHWEST = -2 |
static final int | DIRECTION_WEST = -3 |
static final int | DIRECTION_NORTHWEST = -4 |
static final int | DIRECTION_NONE = 0 |
static final int | DIRECTION_MIN = -4 |
static final int | DIRECTION_MAX = 4 |
static float | SLIDER_MIN_VALUE = 10 |
static float | SLIDER_MAX_VALUE = 50 |
static float | SLIDER_THUMB_VALUE = (SLIDER_MIN_VALUE + SLIDER_MAX_VALUE) / 2.0f |
static final String | DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY = "" |
static final String | DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE = "" |
Protected Member Functions inherited from com.google.appinventor.components.runtime.AndroidViewComponent | |
AndroidViewComponent (ComponentContainer container) | |
Protected Member Functions inherited from com.google.appinventor.components.runtime.VisibleComponent | |
VisibleComponent () | |
Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidViewComponent | |
final ComponentContainer | container |
This class is used to display a Slider
.
A Slider
is a progress bar that adds a draggable thumb. You can touch the thumb and drag left or right to set the slider thumb position. As the Slider thumb is dragged, it will trigger the PositionChanged(float) event, reporting the position of the Slider
thumb. The reported position of the thumb can be used to dynamically update another component attribute, such as the TextBox#FontSize(float) of a TextBox
or the Radius of a Ball
.
The Slider
uses the following default values. However these values can be changed through the Designer or Blocks editor:
Definition at line 60 of file Slider.java.
com.google.appinventor.components.runtime.Slider.Slider | ( | ComponentContainer | container | ) |
Creates a new Slider component.
container | container that the component will be placed in |
Definition at line 104 of file Slider.java.
int com.google.appinventor.components.runtime.Slider.ColorLeft | ( | ) |
Returns the color of the slider bar to the left of the thumb, as an alpha-red-green-blue integer, i.e.,
. An alpha of
indicates fully transparent and
means opaque.
Definition at line 355 of file Slider.java.
void com.google.appinventor.components.runtime.Slider.ColorLeft | ( | int | argb | ) |
Specifies the color of the slider bar to the left of the thumb as an alpha-red-green-blue integer, i.e.,
. An alpha of
indicates fully transparent and
means opaque.
argb | background color in the format 0xAARRGGBB, which includes alpha, red, green, and blue components |
Definition at line 370 of file Slider.java.
int com.google.appinventor.components.runtime.Slider.ColorRight | ( | ) |
Returns the color of the slider bar to the right of the thumb, as an alpha-red-green-blue integer, i.e.,
. An alpha of
indicates fully transparent and
means opaque.
Definition at line 387 of file Slider.java.
void com.google.appinventor.components.runtime.Slider.ColorRight | ( | int | argb | ) |
Specifies the color of the slider bar to the right of the thumb as an alpha-red-green-blue integer, i.e.,
. An alpha of
indicates fully transparent and
means opaque.
argb | background color in the format 0xAARRGGBB, which includes alpha, red, green, and blue components |
Definition at line 402 of file Slider.java.
View com.google.appinventor.components.runtime.Slider.getView | ( | ) |
Returns the View that is displayed in the UI.
Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.
Definition at line 408 of file Slider.java.
int com.google.appinventor.components.runtime.Slider.Height | ( | ) |
Returns the component's vertical height, measured in pixels.
Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.
Definition at line 454 of file Slider.java.
void com.google.appinventor.components.runtime.Slider.Height | ( | int | height | ) |
Specifies the component's vertical height, measured in pixels.
height | in pixels |
Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.
Definition at line 466 of file Slider.java.
float com.google.appinventor.components.runtime.Slider.MaxValue | ( | ) |
Returns the slider max value
@suppressdoc
Definition at line 338 of file Slider.java.
void com.google.appinventor.components.runtime.Slider.MaxValue | ( | float | value | ) |
Sets the maximum value of slider. If the new maximum is less than the current minimum, then minimum and maximum will both be set to this value. Setting MaxValue
resets the thumb position to halfway between MinValue() and MaxValue
and signals the PositionChanged(float)` event.
Definition at line 320 of file Slider.java.
float com.google.appinventor.components.runtime.Slider.MinValue | ( | ) |
Returns the value of slider min value.
@suppressdoc
Definition at line 302 of file Slider.java.
void com.google.appinventor.components.runtime.Slider.MinValue | ( | float | value | ) |
Sets the minimum value of slider. If the new minimum is greater than the current maximum, then minimum and maximum will both be set to this value. Setting MinValue
resets the thumb position to halfway between MinValue
and MaxValue() and signals the PositionChanged(float)` event.
Definition at line 282 of file Slider.java.
void com.google.appinventor.components.runtime.Slider.onProgressChanged | ( | SeekBar | seekBar, |
int | progress, | ||
boolean | fromUser | ||
) |
Definition at line 413 of file Slider.java.
void com.google.appinventor.components.runtime.Slider.onStartTrackingTouch | ( | SeekBar | seekBar | ) |
Definition at line 439 of file Slider.java.
void com.google.appinventor.components.runtime.Slider.onStopTrackingTouch | ( | SeekBar | seekBar | ) |
Definition at line 444 of file Slider.java.
void com.google.appinventor.components.runtime.Slider.PositionChanged | ( | float | thumbPosition | ) |
Indicates that position of the slider thumb has changed.
Definition at line 434 of file Slider.java.
boolean com.google.appinventor.components.runtime.Slider.ThumbEnabled | ( | ) |
Whether or not the slider thumb is being be shown.
Definition at line 226 of file Slider.java.
void com.google.appinventor.components.runtime.Slider.ThumbEnabled | ( | boolean | enabled | ) |
Sets whether or not the slider thumb should be shown
enabled | Whether or not the slider thumb should be shown |
Definition at line 202 of file Slider.java.
float com.google.appinventor.components.runtime.Slider.ThumbPosition | ( | ) |
Returns the position of slider thumb
@suppressdoc
Definition at line 262 of file Slider.java.
void com.google.appinventor.components.runtime.Slider.ThumbPosition | ( | float | position | ) |
Sets the position of the slider thumb. If this value is greater than MaxValue(), then it will be set to same value as MaxValue(). If this value is less than MinValue(), then it will be set to same value as MinValue().
position | the position of the slider thumb. This value should be between sliderMinValue and sliderMaxValue. If this value is not within the min and max, then it will be calculated. |
Definition at line 245 of file Slider.java.
final boolean com.google.appinventor.components.runtime.Slider.referenceGetThumb = (SdkLevel.getLevel() >= SdkLevel.LEVEL_JELLYBEAN) |
Definition at line 97 of file Slider.java.