Buttons are simple controls that can be pressed.
<button text="press me!" ontap="foobar" />
actions.foobar = function ()
print("you pressed a button!");
end
Set the ID for this control so that it can be updated later. See layout library.
<button id="my_btn" />
Set the visibility state using visible
or invisible
or gone
.
<button visibility="gone" />
Set the text to be shown in the button.
<button text="hello world" />
Set horizontal text alignment using left
or center
or right
.
<button text="foo" textalign="right" />
Set a standard control icon. See icons list of available icons.
<button icon="select" />
Set a custom image to use. Should be an absolute path or relative to the layout file.
<button image="img.png" />
Sets the scaling used for images. Values: icon
(default), fill
, fit
, or native
.
<button image="img.png" scale="fit" />
See the styling page for more details.
Occurs when the button is tapped.
<button text="foo" ontap="foo_tapped" />
actions.foo_tapped = function ()
...
end
Occurs when the button is held down.
<button text="bar" onhold="bar_held" />
actions.bar_held = function ()
...
end
Occurs when the button is pressed.
<button text="hello" ondown="hello_down" />
actions.hello_down = function ()
...
end
Occurs when the button released.
<button text="world" onup="world_up" />
actions.world_up = function ()
...
end