AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.Switch Class Reference
Inheritance diagram for com.google.appinventor.components.runtime.Switch:
com.google.appinventor.components.runtime.ToggleBase< CompoundButton >

Public Member Functions

 Switch (ComponentContainer container)
 
int ThumbColorActive ()
 
void ThumbColorActive (int argb)
 
int ThumbColorInactive ()
 
void ThumbColorInactive (int argb)
 
int TrackColorActive ()
 
int TrackColorInactive ()
 
void TrackColorActive (int argb)
 
void TrackColorInactive (int argb)
 
boolean On ()
 
void On (boolean value)
 
void Changed ()
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.ToggleBase< CompoundButton >
 ToggleBase (ComponentContainer container)
 
View getView ()
 
void Changed ()
 
void GotFocus ()
 
void LostFocus ()
 
void BackgroundColor (int argb)
 
int BackgroundColor ()
 
void Enabled (boolean enabled)
 
boolean Enabled ()
 
void FontBold (boolean bold)
 
boolean FontBold ()
 
void FontItalic (boolean italic)
 
boolean FontItalic ()
 
void FontSize (float size)
 
float FontSize ()
 
void FontTypeface (int typeface)
 
int FontTypeface ()
 
void Text (String text)
 
String Text ()
 
void TextColor (int argb)
 
int TextColor ()
 
void onCheckedChanged (CompoundButton buttonView, boolean isChecked)
 
void onFocusChange (View previouslyFocused, boolean gainFocus)
 

Additional Inherited Members

- Protected Member Functions inherited from com.google.appinventor.components.runtime.ToggleBase< CompoundButton >
void initToggle ()
 
- Protected Attributes inherited from com.google.appinventor.components.runtime.ToggleBase< CompoundButton >
view
 

Detailed Description

Switch components can detect user taps and can change their boolean state in response. They are identical to CheckBoxes except in appearance.

Switches have an on (true) state and an off (false) state. A Switch component raises an event when the user taps it to toggle between states.

Definition at line 38 of file Switch.java.

Constructor & Destructor Documentation

◆ Switch()

com.google.appinventor.components.runtime.Switch.Switch ( ComponentContainer  container)

Creates a new Switch component.

Parameters
containercontainer, component will be placed in

Definition at line 56 of file Switch.java.

Member Function Documentation

◆ Changed()

void com.google.appinventor.components.runtime.Switch.Changed ( )

Definition at line 219 of file Switch.java.

◆ On() [1/2]

boolean com.google.appinventor.components.runtime.Switch.On ( )

Returns true if the type% is on.

Returns
true
indicates checked,
false
unchecked

Definition at line 197 of file Switch.java.

◆ On() [2/2]

void com.google.appinventor.components.runtime.Switch.On ( boolean  value)

True if the switch is in the On state, false otherwise.

@internaldoc Checked property setter method.

Parameters
value

Definition at line 212 of file Switch.java.

◆ ThumbColorActive() [1/2]

int com.google.appinventor.components.runtime.Switch.ThumbColorActive ( )

Returns the type%'s thumb color (button that toggles back and forth) when the switch is ON/Checked

Returns
thumb RGB color with alpha

Definition at line 98 of file Switch.java.

◆ ThumbColorActive() [2/2]

void com.google.appinventor.components.runtime.Switch.ThumbColorActive ( int  argb)

Specifies the type%'s thumb color when switch is in the On state.

Parameters
argbthumb RGB color with alpha

Definition at line 110 of file Switch.java.

◆ ThumbColorInactive() [1/2]

int com.google.appinventor.components.runtime.Switch.ThumbColorInactive ( )

Returns the type%'s thumb color (button that toggles back and forth) when the switch is Off/Unchecked

Returns
thumb RGB color with alpha

Definition at line 125 of file Switch.java.

◆ ThumbColorInactive() [2/2]

void com.google.appinventor.components.runtime.Switch.ThumbColorInactive ( int  argb)

Specifies the type%'s thumb color when switch is in the Off state.

Parameters
argbthumb RGB color with alpha

Definition at line 137 of file Switch.java.

◆ TrackColorActive() [1/2]

int com.google.appinventor.components.runtime.Switch.TrackColorActive ( )

Returns the type%'s track color

Returns
track RGB color with alpha

Definition at line 151 of file Switch.java.

◆ TrackColorActive() [2/2]

void com.google.appinventor.components.runtime.Switch.TrackColorActive ( int  argb)

Specifies the type%'s track color when in the On state.

Parameters
argbtrack RGB color with alpha

Definition at line 167 of file Switch.java.

◆ TrackColorInactive() [1/2]

int com.google.appinventor.components.runtime.Switch.TrackColorInactive ( )

Definition at line 155 of file Switch.java.

◆ TrackColorInactive() [2/2]

void com.google.appinventor.components.runtime.Switch.TrackColorInactive ( int  argb)

Specifies the type%'s track color when in the Off state.

Parameters
argb

Definition at line 182 of file Switch.java.


The documentation for this class was generated from the following file: