Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which layout should I use (css inline-block equivalent)

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:

a layout example

Do you have any idea?

Thanks by advance, Valentin

like image 646
ValentinH Avatar asked Jul 04 '13 19:07

ValentinH


People also ask

Why We Use inline-block instead of inline?

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.

What is the difference between display flex and display inline-block?

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.

What is the opposite of inline-block CSS?

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.

What is CSS display inline-block?

“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).


1 Answers

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

like image 60
Ryan S Avatar answered Sep 30 '22 13:09

Ryan S