1 #include "../../lv_examples.h"
2 #if LV_USE_LABEL && LV_BUILD_EXAMPLES
3 
4 /**
5  * Show line wrap, re-color, line align and text scrolling.
6  */
lv_example_label_1(void)7 void lv_example_label_1(void)
8 {
9     lv_obj_t * label1 = lv_label_create(lv_scr_act());
10     lv_label_set_long_mode(label1, LV_LABEL_LONG_WRAP);     /*Break the long lines*/
11     lv_label_set_recolor(label1, true);                      /*Enable re-coloring by commands in the text*/
12     lv_label_set_text(label1, "#0000ff Re-color# #ff00ff words# #ff0000 of a# label, align the lines to the center "
13                       "and wrap long text automatically.");
14     lv_obj_set_width(label1, 150);  /*Set smaller width to make the lines wrap*/
15     lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0);
16     lv_obj_align(label1, LV_ALIGN_CENTER, 0, -40);
17 
18     lv_obj_t * label2 = lv_label_create(lv_scr_act());
19     lv_label_set_long_mode(label2, LV_LABEL_LONG_SCROLL_CIRCULAR);     /*Circular scroll*/
20     lv_obj_set_width(label2, 150);
21     lv_label_set_text(label2, "It is a circularly scrolling text. ");
22     lv_obj_align(label2, LV_ALIGN_CENTER, 0, 40);
23 }
24 
25 #endif
26