Skip to content

Can I use android.widget.ImageButton in Toga? #2087

Answered by freakboy3742
wanglifeng95 asked this question in Q&A
Discussion options

You must be logged in to vote

I can't point you at a simple worked example, but: if you have an instance of toga.Box() called mybox, mybox._impl.native is an instance of android.widget.RelativeLayout, and mybox.container.native_content is another instance of android.widget.RelativeLayout that represents the top-level container for the window being laid out. You can then use Chaquopy's APIs to wrap the Java classes needed to construct an android.widget.ImageButton.

A normal Toga widget would be added to mybox.container.native_content and then have positioning parameters set as part of Toga's layout algorithm; if you were to add a widget to the ._impl.native of a box, that widget should be inserted relative to the posit…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
8 replies
@mhsmith
Comment options

@wanglifeng95
Comment options

@wanglifeng95
Comment options

@freakboy3742
Comment options

@wanglifeng95
Comment options

Answer selected by wanglifeng95
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants