1 #include "../../lv_examples.h"
2 #if LV_USE_BAR && LV_BUILD_EXAMPLES
3
4 /**
5 * Bar with LTR and RTL base direction
6 */
lv_example_bar_5(void)7 void lv_example_bar_5(void)
8 {
9 lv_obj_t * label;
10
11 lv_obj_t * bar_ltr = lv_bar_create(lv_scr_act());
12 lv_obj_set_size(bar_ltr, 200, 20);
13 lv_bar_set_value(bar_ltr, 70, LV_ANIM_OFF);
14 lv_obj_align(bar_ltr, LV_ALIGN_CENTER, 0, -30);
15
16 label = lv_label_create(lv_scr_act());
17 lv_label_set_text(label, "Left to Right base direction");
18 lv_obj_align_to(label, bar_ltr, LV_ALIGN_OUT_TOP_MID, 0, -5);
19
20 lv_obj_t * bar_rtl = lv_bar_create(lv_scr_act());
21 lv_obj_set_style_base_dir(bar_rtl, LV_BASE_DIR_RTL, 0);
22 lv_obj_set_size(bar_rtl, 200, 20);
23 lv_bar_set_value(bar_rtl, 70, LV_ANIM_OFF);
24 lv_obj_align(bar_rtl, LV_ALIGN_CENTER, 0, 30);
25
26 label = lv_label_create(lv_scr_act());
27 lv_label_set_text(label, "Right to Left base direction");
28 lv_obj_align_to(label, bar_rtl, LV_ALIGN_OUT_TOP_MID, 0, -5);
29 }
30
31 #endif
32