ImageButton¶
Example¶
from enamlnative.core.api import *
from enamlnative.widgets.api import *
from enamlnative.android.app import AndroidApplication
enamldef ContentView(FrameLayout):
attr app = AndroidApplication.instance()
Flexbox:
flex_direction = "column"
Button:
text = "default"
text_color = "#f00"
font_family = "sans-serif-light"
align_self = 'flex_end'
text_size = 32
clicked :: app.show_toast("Clicked {}".format(self.text))
Button:
text = "flat"
flat = True
text_color = "#c1a"
align_self = 'flex_start'
clicked :: app.show_toast("Clicked {}".format(self.text))
ToggleButton:
text = "Initial"
text_on = "It's on!"
text_off = "Awwff"
min_width = 400
max_width = 500
align_self = 'center'
clicked :: app.show_toast("State {}".format(self.checked))
FloatingActionButton:
gravity = "bottom|right"
margin = (0, 0, 10, 10)
src = "{md-play-arrow}"
clicked :: app.show_toast("Play clicked!")
Declaration¶
- class enamlnative.widgets.button.ImageButton(parent=None, **kwargs)[source]¶
Bases:
enamlnative.widgets.image_view.ImageView
A simple control for displaying a button with an Image.
- clickable¶
ImageButton is clickable by default
- proxy¶
A reference to the proxy object.
Android Implementation¶
- class enamlnative.android.android_button.AndroidImageButton[source]¶
Bases:
enamlnative.android.android_image_view.AndroidImageView
,enamlnative.widgets.button.ProxyImageButton
An Android implementation of an Enaml ProxyImageButton.
- widget¶
A reference to the widget created by the proxy.
- init_widget()[source]¶
Initialize the underlying widget.
This reads all items declared in the enamldef block for this node and sets only the values that have been specified. All other values will be left as default. Doing it this way makes atom to only create the properties that need to be overridden from defaults thus greatly reducing the number of initialization checks, saving time and memory.
If you don’t want this to happen override get_declared_keys to return an empty list.
No iOS implementation found.