I would like to build a specific layout for an android application. Actually, I would like to obtain something with the same behavior as inline-block div in html/css... I don't really know if I should use a LinearLayout or a GridLayout or something else... It's like a horizontal LinearLayout but when the line is full, I would like my objects to go on the next line... I'm going to add the items programmatically to the container...
Here's an example of what I would like to do:
Do you have any idea?
Thanks by advance, Valentin
The display: inline-block Value Compared to display: inline , the major difference is that display: inline-block allows to set a width and height on the element. Also, with display: inline-block , the top and bottom margins/paddings are respected, but with display: inline they are not.
There is only one main difference between the inline-block and inline-flex: inline-block: Create specific block for each element under its section maintain the structure of each element. inline-flex: Does not reserved any specific space in normal form.
Any element styled with display: block is the polar opposite of display:inline . A block element starts on a new line and occupies the available width of its parent element or its specified width. As you can see, the block element starts on a new line.
“display: inline-block” Property: This property is used to display an element as an inline-level block container. The element itself is formatted as an inline element, but it can apply height and width values. It is placed as an inline element (on the same line as adjacent content).
Instead of using a layout, it might be easier to use a GridView because they will only use memory for items on screen and can be added using an adapter.
Read more here: http://developer.android.com/guide/topics/ui/layout/gridview.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With