对要显示的文本重新着色,可以通过样式来上色,例如:lv_style_set_text_color(&style_obj, lv_color_hex(0xf7b37b)); lv_obj_set_style_text_color(label, lv_color_hex(0xf7b37b), 0); 也可以让文本某些部分重新着色,例如: lv_label_set_recolor(label1, true); lv_label_set_text(label1, "#000...
lv_obj_set_style_local_text_font(label,LV_OBJ_PART_MAIN,LV_STATE_DEFAULT,&mcu_font_16); lv_obj_set_style_local_text_color(label,LV_LABEL_PART_MAIN,LV_STATE_DEFAULT,LV_COLOR_BLUE); lv_obj_set_style_local_bg_color(lv_scr_act(),LV_LABEL_PART_MAIN,LV_STATE_DEFAULT,LV_COLOR_YELLOW)...
lv_color_tdark_purple =lv_palette_darken(LV_PALETTE_PURPLE,2)// 调深两级,最多可以调深或浅 4 级lv_color_tlight_purple =lv_color_lighten(purple,60);// 调浅一些,调到 255 就变成纯白 甚至还可以将两种颜色混合: lv_color_torange =lv_color_mix(red, yellow,156); 比例的取值为 0~255 ,...
} while(0)/* Global variables --- */lv_indev_t*aita_indev;//pointer of indevlv_obj_t*sys_scr;//pointer of system screen instancelv_obj_t*head_label;//pointer of title label instancelv_obj_t*main_label;//pointer of main label instancecharmain_label_text[32];//main label text str...
lv_obj_set_style_local_bg_color(lv_scr_act,LV_LABEL_PART_MAIN,LV_STATE_DEFAULT,LV_COLOR_YELLOW); lv_label_set_text(label," ");//这里为前面5张图片对应的字符 } 将上述LVGL测试程序保存后,切换到 MCU_Font.exe 工具中,点击生成。最后再运行 LVGL 的测试程序。(如下图) ...
lv_obj_t * label = lv_label_create(lv_scr_act()); lv_label_set_text(label, "Hello ...
style1.text.color = lv_color_hex3(0x0F0)/*Label color (green)*/style1.text.font = &lv_font_dejavu_22;/*Change font*/... To set a new style for an object use thelv_<type>set_style(obj, LV_<TYPE>_STYLE_<NAME>, &my_style)functions. For example: ...
lv_obj_set_style_local_bg_color(label, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLUE);//设置背景颜色为蓝色 lv_label_set_recolor(label, true); //使能颜色修改 lv_label_set_text(label, "#ff0000 Hello#");//显示红色Hello
lv_label_set_text(label_line4, "THIS IS T-HEAD RISC-V GUI DEMO");//保持对象的大小不变,当...
lv_label_set_long_mode(label1,LV_LABEL_LONG_BREAK);/*Break the long lines*/lv_label_set_recolor(label1,true);/*Enable re-coloring by commands in the text*/lv_label_set_text(label1,"#0000ff Re-color# #ff00ff words# #ff0000 of a# label ""and wrap long text automatically."); ...