1 #include "../lv_examples.h"
2 #if LV_BUILD_EXAMPLES && LV_USE_IMG
3 
4 /**
5  * Using the Size, Position and Padding style properties
6  */
lv_example_style_1(void)7 void lv_example_style_1(void)
8 {
9     static lv_style_t style;
10     lv_style_init(&style);
11     lv_style_set_radius(&style, 5);
12 
13     /*Make a gradient*/
14     lv_style_set_width(&style, 150);
15     lv_style_set_height(&style, LV_SIZE_CONTENT);
16 
17     lv_style_set_pad_ver(&style, 20);
18     lv_style_set_pad_left(&style, 5);
19 
20     lv_style_set_x(&style, lv_pct(50));
21     lv_style_set_y(&style, 80);
22 
23     /*Create an object with the new style*/
24     lv_obj_t * obj = lv_obj_create(lv_scr_act());
25     lv_obj_add_style(obj, &style, 0);
26 
27     lv_obj_t * label = lv_label_create(obj);
28     lv_label_set_text(label, "Hello");
29 }
30 
31 #endif
32