public abstract class ButtonBase extends AndroidViewComponent implements android.view.View.OnClickListener, android.view.View.OnFocusChangeListener, android.view.View.OnLongClickListener, android.view.View.OnTouchListener
containerACCELEROMETER_SENSITIVITY_MODERATE, ACCELEROMETER_SENSITIVITY_STRONG, ACCELEROMETER_SENSITIVITY_WEAK, ALIGNMENT_CENTER, ALIGNMENT_NORMAL, ALIGNMENT_OPPOSITE, ASSET_DIRECTORY, BUTTON_SHAPE_DEFAULT, BUTTON_SHAPE_OVAL, BUTTON_SHAPE_RECT, BUTTON_SHAPE_ROUNDED, COLOR_BLACK, COLOR_BLUE, COLOR_CYAN, COLOR_DEFAULT, COLOR_DKGRAY, COLOR_GRAY, COLOR_GREEN, COLOR_LTGRAY, COLOR_MAGENTA, COLOR_NONE, COLOR_ORANGE, COLOR_PINK, COLOR_RED, COLOR_WHITE, COLOR_YELLOW, DEFAULT_VALUE_COLOR_BLACK, DEFAULT_VALUE_COLOR_BLUE, DEFAULT_VALUE_COLOR_CYAN, DEFAULT_VALUE_COLOR_DEFAULT, DEFAULT_VALUE_COLOR_DKGRAY, DEFAULT_VALUE_COLOR_GRAY, DEFAULT_VALUE_COLOR_GREEN, DEFAULT_VALUE_COLOR_LTGRAY, DEFAULT_VALUE_COLOR_MAGENTA, DEFAULT_VALUE_COLOR_NONE, DEFAULT_VALUE_COLOR_ORANGE, DEFAULT_VALUE_COLOR_PINK, DEFAULT_VALUE_COLOR_RED, DEFAULT_VALUE_COLOR_WHITE, DEFAULT_VALUE_COLOR_YELLOW, DIRECTION_EAST, DIRECTION_MAX, DIRECTION_MIN, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_NORTHEAST, DIRECTION_NORTHWEST, DIRECTION_SOUTH, DIRECTION_SOUTHEAST, DIRECTION_SOUTHWEST, DIRECTION_WEST, FONT_DEFAULT_SIZE, LAYOUT_ORIENTATION_HORIZONTAL, LAYOUT_ORIENTATION_VERTICAL, LENGTH_FILL_PARENT, LENGTH_PREFERRED, LENGTH_UNKNOWN, SLIDER_MAX_VALUE, SLIDER_MIN_VALUE, SLIDER_THUMB_VALUE, TOAST_LENGTH_LONG, TOAST_LENGTH_SHORT, TYPEFACE_DEFAULT, TYPEFACE_MONOSPACE, TYPEFACE_SANSSERIF, TYPEFACE_SERIF| Constructor and Description |
|---|
ButtonBase(ComponentContainer container)
Creates a new ButtonBase component.
|
| Modifier and Type | Method and Description |
|---|---|
int |
BackgroundColor()
Returns the button's background color as an alpha-red-green-blue
integer.
|
void |
BackgroundColor(int argb)
Specifies the button's background color as an alpha-red-green-blue
integer.
|
abstract void |
click() |
boolean |
Enabled()
Returns true if the button is active and clickable.
|
void |
Enabled(boolean enabled)
Specifies whether the button should be active and clickable.
|
boolean |
FontBold()
Returns true if the button's text should be bold.
|
void |
FontBold(boolean bold)
Specifies whether the button's text should be bold.
|
boolean |
FontItalic()
Returns true if the button's text should be italic.
|
void |
FontItalic(boolean italic)
Specifies whether the button's text should be italic.
|
float |
FontSize()
Returns the button's text's font size, measured in pixels.
|
void |
FontSize(float size)
Specifies the button's text's font size, measured in pixels.
|
int |
FontTypeface()
Returns the button's text's font face as default, serif, sans
serif, or monospace.
|
void |
FontTypeface(int typeface)
Specifies the button's text's font face as default, serif, sans
serif, or monospace.
|
android.view.View |
getView()
Returns the
View that is displayed in the UI. |
void |
GotFocus()
Indicates the cursor moved over the button so it is now possible
to click it.
|
java.lang.String |
Image()
Returns the path of the button's image.
|
void |
Image(java.lang.String path)
Specifies the path of the button's image.
|
boolean |
longClick() |
void |
LostFocus()
Indicates the cursor moved away from the button so it is now no
longer possible to click it.
|
void |
onClick(android.view.View view) |
void |
onFocusChange(android.view.View previouslyFocused,
boolean gainFocus) |
boolean |
onLongClick(android.view.View view) |
boolean |
onTouch(android.view.View view,
android.view.MotionEvent me)
If a custom background images is specified for the button, then it will lose the pressed
and disabled image effects; no visual feedback.
|
int |
Shape()
Returns the style of the button.
|
void |
Shape(int shape)
Specifies the style the button.
|
boolean |
ShowFeedback()
Returns true if the button's text should be bold.
|
void |
ShowFeedback(boolean showFeedback)
Specifies if a visual feedback should be shown when a button with an assigned image
is pressed.
|
java.lang.String |
Text()
Returns the text displayed by the button.
|
void |
Text(java.lang.String text)
Specifies the text displayed by the button.
|
int |
TextAlignment()
Returns the alignment of the button's text: center, normal
(e.g., left-justified if text is written left to right), or
opposite (e.g., right-justified if text is written left to right).
|
void |
TextAlignment(int alignment)
Specifies the alignment of the button's text: center, normal
(e.g., left-justified if text is written left to right), or
opposite (e.g., right-justified if text is written left to right).
|
int |
TextColor()
Returns the button's text color as an alpha-red-green-blue
integer.
|
void |
TextColor(int argb)
Specifies the button's text color as an alpha-red-green-blue
integer.
|
void |
TouchDown()
Indicates when a button is touch down
|
void |
TouchUp()
Indicates when a button touch ends
|
Column, Column, CopyHeight, CopyWidth, getDispatchDelegate, Height, Height, Row, Row, Visible, Visible, Width, Widthpublic ButtonBase(ComponentContainer container)
container - container, component will be placed inpublic boolean onTouch(android.view.View view,
android.view.MotionEvent me)
onTouch in interface android.view.View.OnTouchListenerpublic android.view.View getView()
AndroidViewComponentView that is displayed in the UI.getView in class AndroidViewComponentpublic void TouchDown()
public void TouchUp()
public void GotFocus()
public void LostFocus()
public int TextAlignment()
Component.ALIGNMENT_NORMAL,
Component.ALIGNMENT_CENTER or
Component.ALIGNMENT_OPPOSITEpublic void TextAlignment(int alignment)
alignment - one of Component.ALIGNMENT_NORMAL,
Component.ALIGNMENT_CENTER or
Component.ALIGNMENT_OPPOSITEpublic int Shape()
public void Shape(int shape)
shape - one of Component.BUTTON_SHAPE_DEFAULT,
Component.BUTTON_SHAPE_ROUNDED,
Component.BUTTON_SHAPE_RECT or
Component.BUTTON_SHAPE_OVALjava.lang.IllegalArgumentException - if shape is not a legal value.public java.lang.String Image()
public void Image(java.lang.String path)
MediaUtil.determineMediaSource(com.google.appinventor.components.runtime.Form, java.lang.String) for information about what
a path can be.path - the path of the button's imagepublic int BackgroundColor()
public void BackgroundColor(int argb)
Component.COLOR_DEFAULT, the
original beveling is restored. If an Image has been set, the color
change will not be visible until the Image is removed.argb - background RGB color with alphapublic boolean Enabled()
true indicates enabled, false disabledpublic void Enabled(boolean enabled)
enabled - true for enabled, false disabledpublic boolean FontBold()
true indicates bold, false normalpublic void FontBold(boolean bold)
bold - true indicates bold, false normalpublic void ShowFeedback(boolean showFeedback)
showFeedback - true enables showing feedback,
false disables itpublic boolean ShowFeedback()
true indicates visual feedback will be shown,
false visual feedback will not be shownpublic boolean FontItalic()
true indicates italic, false normalpublic void FontItalic(boolean italic)
italic - true indicates italic, false normalpublic float FontSize()
public void FontSize(float size)
size - font size in pixelpublic int FontTypeface()
public void FontTypeface(int typeface)
typeface - one of Component.TYPEFACE_DEFAULT,
Component.TYPEFACE_SERIF,
Component.TYPEFACE_SANSSERIF or
Component.TYPEFACE_MONOSPACEpublic java.lang.String Text()
public void Text(java.lang.String text)
text - new caption for buttonpublic int TextColor()
public void TextColor(int argb)
argb - text RGB color with alphapublic abstract void click()
public boolean longClick()
public void onClick(android.view.View view)
onClick in interface android.view.View.OnClickListenerpublic void onFocusChange(android.view.View previouslyFocused,
boolean gainFocus)
onFocusChange in interface android.view.View.OnFocusChangeListenerpublic boolean onLongClick(android.view.View view)
onLongClick in interface android.view.View.OnLongClickListener