public class ImageButton extends ImageWidget implements Clickable
NO_CONSTRAINT| Constructor and Description |
|---|
ImageButton(String imagePath)
Creates an image button with the resource path of the image to display.
|
ImageButton(String imagePath,
ResourceImage.OutputFormat outputFormat)
Creates an image button with the resource path and the output format of the image to display.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
handleEvent(int event)
Handles the given event.
|
boolean |
isInState(int state)
Gets whether or not the widget is in the given state.
|
void |
setOnClickListener(OnClickListener listener)
Sets the listener on the click events of this button.
|
void |
setPressed(boolean pressed)
Changes the clickable element state.
|
computeContentOptimalSize, onAttached, onDetached, renderContent, setImagePathaddClassSelector, contains, containsWidget, getAbsoluteX, getAbsoluteY, getContentBounds, getDesktop, getHeight, getParent, getStyle, getWidgetAt, getWidth, getX, getY, hasClassSelector, isAttached, isEnabled, isShown, isTransparent, onHidden, onLaidOut, onShown, removeAllClassSelectors, removeClassSelector, render, requestLayOut, requestRender, requestRender, setClassSelectors, setEnabled, setPosition, setStyle, updateStylepublic ImageButton(String imagePath)
imagePath - the resource path of the image to display.public ImageButton(String imagePath, ResourceImage.OutputFormat outputFormat)
imagePath - the resource path of the image to display.outputFormat - the output format of the image to display.public boolean handleEvent(int event)
Widgetfalse (does not consume event).
Called by the desktop event manager.
handleEvent in class Widgetevent - the event to handle.true if the widget has consumed the event, false otherwise.public boolean isInState(int state)
Widgetpublic void setOnClickListener(@Nullable OnClickListener listener)
listener - the listener to set.public void setPressed(boolean pressed)
ClickablesetPressed in interface Clickablepressed - true if the element is pressed, false otherwise.