当前位置:网站首页>[lvgl layout] grid layout
[lvgl layout] grid layout
2022-07-24 06:46:00 【Like warm know cold】
By looking at LVGL Of Widgets demo Source code , This can be found demo Grid layout adopted , Analyze the code of grid layout , Don't look at the flexible layout first !

Row and column size description
You must describe the size of rows and columns , You can do this by declaring two arrays . The last element of the array is LV_GRID_TEMPLATE_LAST .
for example :
static lv_coord_t column_dsc[] = {100, 400, LV_GRID_TEMPLATE_LAST}; /*2 columns with 100 and 400 ps width*/
static lv_coord_t row_dsc[] = {100, 100, 100, LV_GRID_TEMPLATE_LAST}; /*3 100 px tall rows*/After creation , Kebi created a cell ! Take the example above as 3×2 form !
In addition to pixel settings , There are also two special value settings :
- LV_GRID_CONTENT: Set the width to the largest sub object .
- LV_GRID_FR(x) : Which part of the remaining space is used . The bigger the value is. , The bigger the space .
About the definition of these two :
#define LV_GRID_FR(x) (LV_COORD_MAX - 100 + x)
#define LV_GRID_CONTENT (LV_COORD_MAX - 101for example :
static lv_coord_t grid_main_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_main_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
Set the description on the parent :
lv_obj_set_grid_dsc_array(obj, col_dsc, row_dsc)Add sub objects to the mesh !
Sub objects need to be added manually !
lv_obj_set_grid_cell(child, column_align, column_pos, column_span, row_align, row_pos, row_span)Parameters :
column_align & row_align Determine how to align child objects . Optional parameters :
- LV_GRID_ALIGN_START: Horizontal left , Vertically
- LV_GRID_ALIGN_CENTER: In the middle
- LV_GRID_ALIGN_END: Horizontal right , Vertically
column_pos & row_pos Determine the position of the placed cell .
column_span & row_span How many cells should the item involve starting from the starting cell . must ≥1.
Example :
lv_obj_set_grid_cell(panel2_title, LV_GRID_ALIGN_START, 0, 2, LV_GRID_ALIGN_CENTER, 0, 1);
lv_obj_set_grid_cell(user_name, LV_GRID_ALIGN_STRETCH, 0, 1, LV_GRID_ALIGN_CENTER, 3, 1);
lv_obj_set_grid_cell(user_name_label, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 2, 1);Grid alignment
- LV_GRID_ALIGN_START: Horizontal left , Vertically
- LV_GRID_ALIGN_CENTER: In the middle
- LV_GRID_ALIGN_END: Horizontal right , Vertically
- LV_GRID_ALIGN_STRETCH:
- LV_GRID_ALIGN_SPACE_EVENLY: Make the distance between two items equal
- LV_GRID_ALIGN_SPACE_AROUND: In a row / Evenly distributed on the column , Visual space is not equal
- LV_GRID_ALIGN_SPACE_BETWEEN: In a row / Evenly distributed on the column
Be careful track_cross_place Applicable problems under . Set track alignment , Need to use :
lv_obj_set_grid_align(obj, column_align, row_align)Grid style
lv_style_set_<property_name>(&style, <value>);
lv_obj_set_style_<property_name>(obj, <value>, <selector>);
- GRID_COLUMN_DSC_ARRAY
- GRID_ROW_DSC_ARRAY
- GRID_COLUMN_ALIGN
- GRID_ROW_ALIGN
- GRID_CELL_X_ALIGN
- GRID_CELL_COLUMN_POS
- GRID_CELL_COLUMN_SPAN
- GRID_CELL_Y_ALIGN
- GRID_CELL_ROW_POS
- GRID_CELL_ROW_SPAN
Content filling
To be modified Grid The minimum space to insert between objects , Can be in Grid Set the following properties on the container style :
- pad_row Set padding between rows .
- pad_column Set the padding between columns .
generally speaking , Simple grid layout can be realized here .
边栏推荐
- Backup MySQL database with bat script under Windows
- Neural network superparameter adjustment (based on ray package)
- Experiment: creation, expansion, and deletion of LVM logical volumes
- 【ESP8266点焊机】基于 ESP8266 for Arduino
- 【音频解码芯片】VS1503音频解码芯片的应用
- 机器学习案例:孕妇吸烟与胎儿健康
- 磁盘管理和文件系统
- Redis.conf详解
- 【LVGL】【阶段总结1】
- Today, let's talk about the underlying architecture design of MySQL database. How much do you know?
猜你喜欢

Quick start of go language
![JS: why [] = =! [] return true?](/img/36/94839bf4ce6bd06d2cbe989828c791.png)
JS: why [] = =! [] return true?

Account and authority management

【LVGL(4)】对象的事件及事件冒泡

You don't know these pits. You really don't dare to use BigDecimal

PXE technology network installation

神经网络超参数调整(基于ray包)

mysql获取自增行标(区别mysql版本)
![[audio decoding chip] Application of vs1503 audio decoding chip](/img/ee/0d5f95fba647592cc95f1e9f410bc9.png)
[audio decoding chip] Application of vs1503 audio decoding chip

Special effects - bubble tailing occurs when the mouse moves
随机推荐
Niuke net brush questions
adb交互-干掉难看的默认shell界面
Process and planned task management
Neural network superparameter adjustment (based on ray package)
Why can't index be the key of V-for?
Redis基本类型-有序集合Zset
Yiwen node installation, download and configuration
Kubernetes' deployment, service concept, dynamic capacity expansion
Iterators and generators
【ESP8266点焊机】基于 ESP8266 for Arduino
OpenSSL version upgrade
Promise
STM32基于 FatFs R0.14b&SD Card 的MP3音乐播放器(也算是FatFs的简单应用了吧)
【LVGL(6)】显示中文设置,制作中文字库
RAID configuration experiment
实验:磁盘配额操作
These 10 kinds of timed tasks have been learned, and you can float directly
STM32 MP3 music player based on FatFs r0.14b & SD card (also a simple application of FatFs)
Summary browser object
Visibility:hidden and display:none