How to draw a dynamic icon

Description

how to draw a icon then update it dynamic.such as battery icon

What MCU/Processor/Board and compiler are you using?

What LVGL version are you using?

What do you want to achieve?

What have you tried so far?

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Hi
You can create an img by using lv_img_create and update its image whenever you want by using lv_img_set_src.
Depends on the situation using lv_img_set_offset_x and lv_img_set_offset_y are good too.
Also, don’t forget to enable its click feature by lv_obj_set_click as for img objects click is disabled by default.
PS:
It would be better to specify your need and explain more about it, so we can help you better.

1 Like