lvgl page(页表控件)

源代码

	//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.");

效果演示

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值