{/*Create an array for the points of the line*/staticlv_point_t line_points[]={{5,5},{70,70},{120,10},{180,60},{240,10}};// 5个点坐标值/*Create style*/staticlv_style_t style_line;lv_style_init(&style_line);lv_style_set_line_width(&style_line,8);// 设置线宽lv_style_set_line_color(&style_line,lv_palette_main(LV_PALETTE_BLUE));//设置线条颜色为蓝色lv_style_set_line_rounded(&style_line, true);// 使能线条圆角功能/*Create a line and apply the new style*/lv_obj_t* line1;
line1 =lv_line_create(lv_scr_act());// 创建线条对象lv_line_set_points(line1, line_points,5);// 设置线条数据点数lv_obj_add_style(line1,&style_line,0);// 线条添加stylelv_obj_center(line1);// 居中显示}