当前位置:网站首页>LVGL 8.2 Line wrap, recoloring and scrolling
LVGL 8.2 Line wrap, recoloring and scrolling
2022-07-04 13:07:00 【仙剑情缘】
Line wrap, recoloring and scrolling示例
static void lv_example_label_1(void)
{
lv_obj_t* label1 = lv_label_create(lv_scr_act()); // 创建Label对象
lv_label_set_long_mode(label1, LV_LABEL_LONG_WRAP); //LV_LABEL_LONG_WRAP模式
lv_label_set_recolor(label1, true); // 使能重新着色功能
lv_label_set_text(label1, "#0000ff Re-color# #ff00ff words# #ff0000 of a# label,align the lines to the center "
"and wrap long text automatically."); //Re-color重新着色为蓝色,words着色为紫色,of a着色为红色,其它的为控件的默认颜色
lv_obj_set_width(label1, 150); //设置label宽度
lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0); //添加style特性LV_TEXT_ALIGN_CENTER到label对象
lv_obj_align(label1, LV_ALIGN_CENTER, 0, -40); // LV_ALIGN_CENTER方式对齐
lv_obj_t* label2 = lv_label_create(lv_scr_act()); // 创建Label对象
lv_label_set_long_mode(label2, LV_LABEL_LONG_SCROLL_CIRCULAR); //LV_LABEL_LONG_SCROLL_CIRCULAR循环滚动模式
lv_obj_set_width(label2, 150);//设置label宽度
lv_label_set_text(label2, "It is a circularly scrolling text. "); //设置Label显示内容
lv_obj_align(label2, LV_ALIGN_CENTER, 0, 40);//LV_ALIGN_CENTER方式对齐
}
运行效果
- 修改滚动Label宽度到320
lv_obj_set_width(label2, 320);
- 运行效果
边栏推荐
猜你喜欢
MySQL之详解索引
codeforce:C. Sum of Substrings【边界处理 + 贡献思维 + 灵光一现】
Leetcode T48: rotating images
SqlServer函数,存储过程的创建和使用
Detailed analysis of pytorch's automatic derivation mechanism, pytorch's core magic
Innovation and development of independent industrial software
Talk about 10 tips to ensure thread safety
失败率高达80%,企业数字化转型路上有哪些挑战?
Nowcoder rearrange linked list
电商系统中红包活动设计
随机推荐
游戏出海,全球化运营
LiveData
Redis daily notes
nowcoder重排链表
Excel quickly merges multiple rows of data
Rich text editing: wangeditor tutorial
The failure rate is as high as 80%. What are the challenges on the way of enterprise digital transformation?
数据仓库面试问题准备
Popular framework: the use of glide
电商系统中红包活动设计
Chapter 16 string localization and message Dictionary (2)
Solutions aux problèmes d'utilisation de l'au ou du povo 2 dans le riz rouge k20pro MIUI 12.5
SqlServer函数,存储过程的创建和使用
Excel快速合并多行数据
MySQL的触发器
Transplant tinyplay for imx6q development board QT system
[MySQL from introduction to proficiency] [advanced chapter] (V) SQL statement execution process of MySQL
Detailed index of MySQL
Remove duplicate letters [greedy + monotonic stack (maintain monotonic sequence with array +len)]
架构方面的进步