#

  1. static lv_style_t style_line;
  2. lv_style_init(&style_line);
  3. lv_style_set_line_width(&style_line, LV_STATE_DEFAULT, 8);
  4. lv_style_set_line_color(&style_line, LV_STATE_DEFAULT, LV_COLOR_BLUE);
  5. lv_style_set_line_rounded(&style_line, LV_STATE_DEFAULT, true);
  6. static lv_obj_t* line1;
  7. line1 = lv_line_create(lv_scr_act(), NULL);
  8. static lv_point_t line_points[] = { {0, 0}, {70, 70}, {120, 10}, {180, 60}, {240, 10} };
  9. // 设置
  10. lv_line_set_points(line1, line_points, 5);
  11. lv_obj_add_style(line1, LV_LINE_PART_MAIN, &style_line);
  12. lv_obj_align(line1, NULL, LV_ALIGN_CENTER, 0, 0);
  13. // 设置y轴反转
  14. lv_line_set_y_invert(line1, false);