1. 程式人生 > 其它 >lvgl label(標籤)

lvgl label(標籤)

技術標籤:GUI

原始碼:

	//13. label標籤控制元件
	//13.1 建立標籤
	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_IN_TOP_LEFT, 0, 0);

	lv_obj_t * label2 = lv_label_create(lv_scr_act(), NULL);
	lv_label_set_long_mode(label2, LV_LABEL_LONG_SROLL_CIRC);     /*Circular scroll*/
	lv_obj_set_width(label2, 150);
	lv_label_set_text(label2, "It is a circularly scrolling text. ");
	lv_obj_align(label2, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 60);

效果演示: