zl程序教程

您现在的位置是:首页 >  其它

当前栏目

label recoloring and scrolling for little vGL

for and Label Little
2023-09-14 09:11:17 时间
  • label重新着色和字符滚动实现

    void label_recoloring_scroling(void)
    {
        lv_obj_t* label1 = lv_label_create(lv_scr_act(), NULL);
        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_align(label1, LV_LABEL_ALIGN_CENTER); /*Center aligned lines*/
        lv_label_set_text(label1, "#000080 Re-color# #0000ff words# #6666ff of a# label " "and wrap long text automatically."); 
        lv_obj_set_width(label1, 150); 
        lv_obj_align(label1, NULL, LV_ALIGN_CENTER, 0, -30);
    
    
        lv_obj_t* label2 = lv_label_create(lv_scr_act(), NULL);
        lv_label_set_long_mode(label2, LV_LABEL_LONG_SROLL_CIRC);
        lv_obj_set_width(label2, 150);
        lv_label_set_text(label2, "It is a circularly scrolling text. ");
        lv_obj_align(label2, NULL, LV_ALIGN_CENTER, 0, 30);
    }
  • 效果图