源代码 //19. 页表控件 //19.1 页表类型创建 static lv_style_t style_sb; lv_style_copy(style_sb, lv_style_plain); style_sb.body.main_color = LV_COLOR_BLACK; style_sb.body.grad_color = LV_COLOR_BLACK; style_sb.body.border.color = L
源代码
//19. 页表控件
//19.1 页表类型创建
static lv_style_t style_sb;
lv_style_copy(&style_sb, &lv_style_plain);
style_sb.body.main_color = LV_COLOR_BLACK;
style_sb.body.grad_color = LV_COLOR_BLACK;
style_sb.body.border.color = LV_COLOR_WHITE;
style_sb.body.border.width = 1;
style_sb.body.border.opa = LV_OPA_70;
style_sb.body.radius = LV_RADIUS_CIRCLE;
style_sb.body.opa = LV_OPA_60;
style_sb.body.padding.right = 3;
style_sb.body.padding.bottom = 3;
style_sb.body.padding.inner = 8; /*Scrollbar width*/
//19.2 创建页表控件
lv_obj_t * page = lv_page_create(lv_scr_act(), NULL);
lv_obj_set_size(page, 150, 80);
lv_obj_align(page, NULL, LV_ALIGN_IN_BOTTOM_MID, -180, -40);
lv_page_set_style(page, LV_PAGE_STYLE_SB, &style_sb); /*Set the scrollbar style*/
//19.3 将标签信息填充到页表
lv_obj_t * label_page = lv_label_create(page, NULL);
lv_label_set_long_mode(label_page, LV_LABEL_LONG_BREAK); /*Automatically break long lines*/
lv_obj_set_width(label_page, lv_page_get_fit_width(page)); /*Set the label width to max value to not show hor. scroll bars*/
lv_label_set_text(label_page, "Lorem ipsum dolor sit amet, consectetur adipiscing elit,\n"
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n"
"Ut enim ad minim veniam, quis nostrud exercitation ullamco\n"
"laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure\n"
"dolor in reprehenderit in voluptate velit esse cillum dolore\n"
"eu fugiat nulla pariatur.\n"
"Excepteur sint occaecat cupidatat non proident, sunt in culpa\n"
"qui officia deserunt mollit anim id est laborum.");
效果演示