源代码
//15. 线控件
//15.1 设置线的点
static lv_point_t line_points[] = { { 0, 0 },{ 60, 0 },{ 60, 60 },{ 0, 60 },{ 0, 0 } };
//15.2 布局设置(线的颜色,宽度,圆角)
static lv_style_t style_line;
lv_style_copy(&style_line, &lv_style_plain);
style_line.line.color = LV_COLOR_MAKE(0x25, 0x3b, 0x75);
style_line.line.width = 5;
style_line.line.rounded = 0;
//15.3 创建一个线控件
lv_obj_t * line1;
line1 = lv_line_create(lv_scr_act(), NULL);
lv_line_set_points(line1, line_points, 5); /*Set the points*/
lv_line_set_style(line1, LV_LINE_STYLE_MAIN, &style_line);
lv_obj_align(line1, NULL, LV_ALIGN_CENTER, 160, 0);
效果演示