feat(bar): reverse drawing direction of lv_bar if min > max (#4654)
Signed-off-by: wangxuedong <wangxuedong@xiaomi.com>
This commit is contained in:
@@ -34,3 +34,9 @@ Custom drawer to show the current value
|
||||
.. lv_example:: widgets/bar/lv_example_bar_6
|
||||
:language: c
|
||||
|
||||
Bar with opposite direction
|
||||
---------------------------
|
||||
|
||||
.. lv_example:: widgets/bar/lv_example_bar_7
|
||||
:language: c
|
||||
|
||||
|
||||
23
examples/widgets/bar/lv_example_bar_7.c
Normal file
23
examples/widgets/bar/lv_example_bar_7.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_BAR && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Bar with opposite direction
|
||||
*/
|
||||
void lv_example_bar_7(void)
|
||||
{
|
||||
lv_obj_t * label;
|
||||
|
||||
|
||||
lv_obj_t * bar_tob = lv_bar_create(lv_scr_act());
|
||||
lv_obj_set_size(bar_tob, 20, 200);
|
||||
lv_bar_set_range(bar_tob, 100, 0);
|
||||
lv_bar_set_value(bar_tob, 70, LV_ANIM_OFF);
|
||||
lv_obj_align(bar_tob, LV_ALIGN_CENTER, 0, -30);
|
||||
|
||||
label = lv_label_create(lv_scr_act());
|
||||
lv_label_set_text(label, "From top to bottom");
|
||||
lv_obj_align_to(label, bar_tob, LV_ALIGN_OUT_TOP_MID, 0, -5);
|
||||
}
|
||||
|
||||
#endif
|
||||
1
examples/widgets/bar/lv_example_bar_7.py
Normal file
1
examples/widgets/bar/lv_example_bar_7.py
Normal file
@@ -0,0 +1 @@
|
||||
pass
|
||||
Reference in New Issue
Block a user