Create your own screen

custom it make it your own

start with basic widget

“Label”

สร้างแถบข้อความ Hello world บนหน้าจอ Widget : Label

lv_obj_t * label1 = lv_label_create(lv_scr_act());          /*สร้างแถบข้อความ*/
    lv_label_set_text(label1, "Hello world");               /*กำหนดข้อความ*/
    lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0); /*วางข้อความไว้กลางแถบข้อความ*/
    lv_obj_align(label1, LV_ALIGN_CENTER, 0, -40);          /*วางแถบข้อความไว้กลางจอแล้วเลื่อนไปด้านบน*/

  lv_obj_t * label2 = lv_label_create(lv_scr_act());        /*สร้างแถบข้อความ*/
    lv_label_set_recolor(label2, true);                     /*เปิดโหมดเปลี่ยนสีข้อความ/
    lv_label_set_text(label2, "#0000ff Hello world but blue");     /*กำหนดข้อความ*/
    lv_obj_set_style_text_align(label2, LV_TEXT_ALIGN_CENTER, 0);  /*วางข้อความไว้กลางแถบข้อความ*/
    lv_obj_align(label2, LV_ALIGN_CENTER, 0, 0);            /*วางแถบข้อความไว้กลางจอ*/
  
  lv_obj_t * label3 = lv_label_create(lv_scr_act());        /*สร้างแถบข้อความ*/
    lv_label_set_recolor(label3, true);                     /*เปิดโหมดเปลี่ยนสีข้อความ/
    lv_label_set_text(label3, "#ff0000 Hello world but red");      /*กำหนดข้อความ*/
    lv_obj_set_style_text_align(label3, LV_TEXT_ALIGN_CENTER, 0);  /*วางข้อความไว้กลางแถบข้อความ*/
    lv_obj_align(label3, LV_ALIGN_CENTER, 0, 40);           /*วางแถบข้อความไว้กลางจอแล้วเลื่อนไปด้านล่าง*/

“Arc”

สร้างเส้นโค้งบนหน้าจอ Widget : Arc

“Button”

สร้างปุ่มกดของคุณ Widget : Button

“Bar”

สร้างแถบสถานะของคุณเอง Widget : Bar

“Status”

สร้าง label แสดงค่าของ Object คุณ Widget : Arc (can be anything else)

Extend : "Arc + text"

สร้าง Half Arc + ข้อความ

Last updated

Was this helpful?