I have a layout in mind that I don't know how to create with LinearLayout
or ConstraintLayout
. So I'd like to write code to do it manually. The code would look at the screen size and button sizes, and compute and set the button positions. Is that possible? Where would I put that code in my Fragment
subclass?
Below is the layout I'm going for. In iOS I would express it with "constraints", but I'm new to Android and don't know how to do this. If there is a way to do this without Java/Kotlin code outside the layout XML files, I'd still like to know where that custom code would go.
In the screen below, I'd like:
- A minimum side padding around the button text.
- All the buttons are the same width.
- If the default font is increased, so the buttons fill the screen, I can give up the side padding before to truncating the button text.