mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
docs(layer): fix layer rst function error (#7541)
Co-authored-by: lizhaoming <13678462+lizhao-ming@user.noreply.gitee.com>
This commit is contained in:
parent
692830d27c
commit
39d0d1037a
@ -33,22 +33,21 @@ its children.
|
||||
.. code-block:: c
|
||||
|
||||
/* Create a screen */
|
||||
lv_obj_t * scr = lv_obj_create(NULL, NULL);
|
||||
lv_obj_t * scr = lv_obj_create(NULL);
|
||||
lv_screen_load(scr); /* Load the screen */
|
||||
|
||||
/* Create 2 buttons */
|
||||
lv_obj_t * btn1 = lv_button_create(scr, NULL); /* Create a button on the screen */
|
||||
lv_button_set_fit(btn1, true, true); /* Enable automatically setting the size according to content */
|
||||
lv_obj_set_pos(btn1, 60, 40); /* Set the position of the button */
|
||||
lv_obj_t * btn1 = lv_button_create(scr); /* Create the first button on the screen */
|
||||
lv_obj_set_pos(btn1, 60, 40); /* Set the position of the first button */
|
||||
|
||||
lv_obj_t * btn2 = lv_button_create(scr, btn1); /* Copy the first button */
|
||||
lv_obj_set_pos(btn2, 180, 80); /* Set the position of the button */
|
||||
lv_obj_t * btn2 = lv_button_create(scr); /* Create the second button on the screen */
|
||||
lv_obj_set_pos(btn2, 180, 80); /* Set the position of the second button */
|
||||
|
||||
/* Add labels to the buttons */
|
||||
lv_obj_t * label1 = lv_label_create(btn1, NULL); /* Create a label on the first button */
|
||||
lv_obj_t * label1 = lv_label_create(btn1); /* Create a label on the first button */
|
||||
lv_label_set_text(label1, "Button 1"); /* Set the text of the label */
|
||||
|
||||
lv_obj_t * label2 = lv_label_create(btn2, NULL); /* Create a label on the second button */
|
||||
lv_obj_t * label2 = lv_label_create(btn2); /* Create a label on the second button */
|
||||
lv_label_set_text(label2, "Button 2"); /* Set the text of the label */
|
||||
|
||||
/* Delete the second label */
|
||||
|
Loading…
x
Reference in New Issue
Block a user