「App:Library:LVGL:docs:Layouts:Flex」の版間の差分
10行目: | 10行目: | ||
= Flex = | = Flex = | ||
− | |||
== Overview == | == Overview == | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
The Flexbox (or Flex for short) is a subset of CSS Flexbox. | The Flexbox (or Flex for short) is a subset of CSS Flexbox. | ||
21行目: | 25行目: | ||
== Terms == | == Terms == | ||
− | + | {| class="wikitable" | |
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
* tracks: the rows or columns | * tracks: the rows or columns | ||
* main direction: row or column, the direction in which the items are placed | * main direction: row or column, the direction in which the items are placed | ||
30行目: | 38行目: | ||
== Simple interface == | == Simple interface == | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
With the following functions you can set a Flex layout on any parent. | With the following functions you can set a Flex layout on any parent. | ||
+ | | | ||
+ | |} | ||
+ | |||
=== Flex flow === | === Flex flow === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
<code>lv_obj_set_flex_flow(obj, flex_flow)</code> | <code>lv_obj_set_flex_flow(obj, flex_flow)</code> | ||
45行目: | 66行目: | ||
* <code>LV_FLEX_FLOW_ROW_WRAP_REVERSE</code> Place the children in a row with wrapping but in reversed order | * <code>LV_FLEX_FLOW_ROW_WRAP_REVERSE</code> Place the children in a row with wrapping but in reversed order | ||
* <code>LV_FLEX_FLOW_COLUMN_WRAP_REVERSE</code> Place the children in a column with wrapping but in reversed order | * <code>LV_FLEX_FLOW_COLUMN_WRAP_REVERSE</code> Place the children in a column with wrapping but in reversed order | ||
+ | | | ||
+ | |} | ||
+ | |||
=== Flex align === | === Flex align === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
To manage the placement of the children use <code>lv_obj_set_flex_align(obj, main_place, cross_place, track_cross_place)</code> | To manage the placement of the children use <code>lv_obj_set_flex_align(obj, main_place, cross_place, track_cross_place)</code> | ||
61行目: | 90行目: | ||
* <code>LV_FLEX_ALIGN_SPACE_AROUND</code> items are evenly distributed in the track with equal space around them. Note that visually the spaces aren’t equal, since all the items have equal space on both sides. The first item will have one unit of space against the container edge, but two units of space between the next item because that next item has its own spacing that applies. Not applies to <code>track_cross_place</code>. | * <code>LV_FLEX_ALIGN_SPACE_AROUND</code> items are evenly distributed in the track with equal space around them. Note that visually the spaces aren’t equal, since all the items have equal space on both sides. The first item will have one unit of space against the container edge, but two units of space between the next item because that next item has its own spacing that applies. Not applies to <code>track_cross_place</code>. | ||
* <code>LV_FLEX_ALIGN_SPACE_BETWEEN</code> items are evenly distributed in the track: first item is on the start line, last item on the end line. Not applies to <code>track_cross_place</code>. | * <code>LV_FLEX_ALIGN_SPACE_BETWEEN</code> items are evenly distributed in the track: first item is on the start line, last item on the end line. Not applies to <code>track_cross_place</code>. | ||
+ | | | ||
+ | |} | ||
+ | |||
=== Flex grow === | === Flex grow === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
Flex grow can be used to make one or more children fill the available space on the track. When more children have grow parameters, the available space will be distributed proportionally to the grow values. For example, there is 400 px remaining space and 4 objects with grow: | Flex grow can be used to make one or more children fill the available space on the track. When more children have grow parameters, the available space will be distributed proportionally to the grow values. For example, there is 400 px remaining space and 4 objects with grow: | ||
72行目: | 109行目: | ||
Flex grow can be set on a child with <code>lv_obj_set_flex_grow(child, value)</code>. <code>value</code> needs to be > 1 or 0 to disable grow on the child. | Flex grow can be set on a child with <code>lv_obj_set_flex_grow(child, value)</code>. <code>value</code> needs to be > 1 or 0 to disable grow on the child. | ||
+ | | | ||
+ | |} | ||
+ | |||
== Style interface == | == Style interface == | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
All the Flex-related values are style properties under the hood and you can use them similarly to any other style property. The following flex related style properties exist: | All the Flex-related values are style properties under the hood and you can use them similarly to any other style property. The following flex related style properties exist: | ||
81行目: | 126行目: | ||
* <code>FLEX_TRACK_PLACE</code> | * <code>FLEX_TRACK_PLACE</code> | ||
* <code>FLEX_GROW</code> | * <code>FLEX_GROW</code> | ||
+ | | | ||
+ | |} | ||
+ | |||
=== Internal padding === | === Internal padding === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
To modify the minimum space flexbox inserts between objects, the following properties can be set on the flex container style: | To modify the minimum space flexbox inserts between objects, the following properties can be set on the flex container style: | ||
89行目: | 142行目: | ||
These can for example be used if you don't want any padding between your objects: <code>lv_style_set_pad_column(&row_container_style,0)</code> | These can for example be used if you don't want any padding between your objects: <code>lv_style_set_pad_column(&row_container_style,0)</code> | ||
+ | | | ||
+ | |} | ||
+ | |||
== Other features == | == Other features == | ||
− | |||
=== RTL === | === RTL === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
If the base direction of the container is set the <code>LV_BASE_DIR_RTL</code> the meaning of <code>LV_FLEX_ALIGN_START</code> and <code>LV_FLEX_ALIGN_END</code> is swapped on <code>ROW</code> layouts. I.e. <code>START</code> will mean right. | If the base direction of the container is set the <code>LV_BASE_DIR_RTL</code> the meaning of <code>LV_FLEX_ALIGN_START</code> and <code>LV_FLEX_ALIGN_END</code> is swapped on <code>ROW</code> layouts. I.e. <code>START</code> will mean right. | ||
The items on <code>ROW</code> layouts, and tracks of <code>COLUMN</code> layouts will be placed from right to left. | The items on <code>ROW</code> layouts, and tracks of <code>COLUMN</code> layouts will be placed from right to left. | ||
+ | | | ||
+ | |} | ||
+ | |||
=== New track === | === New track === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
You can force Flex to put an item into a new line with <code>lv_obj_add_flag(child, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK)</code>. | You can force Flex to put an item into a new line with <code>lv_obj_add_flag(child, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK)</code>. | ||
+ | | | ||
+ | |} | ||
+ | |||
== Example == | == Example == | ||
=== A simple row and a column layout with flexbox === | === A simple row and a column layout with flexbox === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
[[file:LVGL docs example 024.png|link=https://docs.lvgl.io/8.2/layouts/flex.html#a-simple-row-and-a-column-layout-with-flexbox]] | [[file:LVGL docs example 024.png|link=https://docs.lvgl.io/8.2/layouts/flex.html#a-simple-row-and-a-column-layout-with-flexbox]] | ||
− | + | |- | |
− | + | | | |
=== Arrange items in rows with wrap and even spacing === | === Arrange items in rows with wrap and even spacing === | ||
[[file:LVGL docs example 025.png|link=https://docs.lvgl.io/8.2/layouts/flex.html#arrange-items-in-rows-with-wrap-and-even-spacing]] | [[file:LVGL docs example 025.png|link=https://docs.lvgl.io/8.2/layouts/flex.html#arrange-items-in-rows-with-wrap-and-even-spacing]] | ||
− | + | |- | |
− | + | | | |
=== Demonstrate flex grow === | === Demonstrate flex grow === | ||
[[file:LVGL docs example 026.png|link=https://docs.lvgl.io/8.2/layouts/flex.html#demonstrate-flex-grow]] | [[file:LVGL docs example 026.png|link=https://docs.lvgl.io/8.2/layouts/flex.html#demonstrate-flex-grow]] | ||
− | + | |- | |
− | + | | | |
=== Demonstrate flex grow. === | === Demonstrate flex grow. === | ||
[[file:LVGL docs example 027.png|link=https://docs.lvgl.io/8.2/layouts/flex.html#id1]] | [[file:LVGL docs example 027.png|link=https://docs.lvgl.io/8.2/layouts/flex.html#id1]] | ||
− | + | |- | |
− | + | | | |
=== Demonstrate column and row gap style properties === | === Demonstrate column and row gap style properties === | ||
[[file:LVGL docs example 028.png|link=https://docs.lvgl.io/8.2/layouts/flex.html#demonstrate-column-and-row-gap-style-properties]] | [[file:LVGL docs example 028.png|link=https://docs.lvgl.io/8.2/layouts/flex.html#demonstrate-column-and-row-gap-style-properties]] | ||
− | + | |- | |
− | + | | | |
=== RTL base direction changes order of the items === | === RTL base direction changes order of the items === | ||
[[file:LVGL docs example 029.png|link=https://docs.lvgl.io/8.2/layouts/flex.html#rtl-base-direction-changes-order-of-the-items]] | [[file:LVGL docs example 029.png|link=https://docs.lvgl.io/8.2/layouts/flex.html#rtl-base-direction-changes-order-of-the-items]] | ||
− | + | | | |
− | + | |} | |
== API == | == API == | ||
256行目: | 332行目: | ||
; <span id="_CPPv318LV_STYLE_FLEX_GROW"></span><span id="_CPPv218LV_STYLE_FLEX_GROW"></span><span id="LV_STYLE_FLEX_GROW__lv_style_prop_t"></span><span id="lv__flex_8h_1ad2de1ff10fd59340f57bb14b9cd74ccd" class="target"></span>lv_style_prop_t LV_STYLE_FLEX_G[https://docs.lvgl.io/8.2/layouts/flex.html#_CPPv425LV_STYLE_FLEX_TRACK_PLACE]ROW | ; <span id="_CPPv318LV_STYLE_FLEX_GROW"></span><span id="_CPPv218LV_STYLE_FLEX_GROW"></span><span id="LV_STYLE_FLEX_GROW__lv_style_prop_t"></span><span id="lv__flex_8h_1ad2de1ff10fd59340f57bb14b9cd74ccd" class="target"></span>lv_style_prop_t LV_STYLE_FLEX_G[https://docs.lvgl.io/8.2/layouts/flex.html#_CPPv425LV_STYLE_FLEX_TRACK_PLACE]ROW | ||
− | + | | | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
:[[App:Library:LVGL:docs:Layouts|戻る : Previous]] | :[[App:Library:LVGL:docs:Layouts|戻る : Previous]] |
2022年6月28日 (火) 13:20時点における版
https://docs.lvgl.io/8.2/layouts/flex.html
英文 | 自動翻訳 |
---|---|
Flex
Overview
英文 | 自動翻訳 | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Flexbox (or Flex for short) is a subset of CSS Flexbox. It can arrange items into rows or columns (tracks), handle wrapping, adjust the spacing between the items and tracks, handle grow to make the item(s) fill the remaining space with respect to min/max width and height. To make an object flex container call Note that the flex layout feature of LVGL needs to be globally enabled with Terms
|