2021-04-08 13:07:48 +02:00
|
|
|
#include "../lv_examples.h"
|
2023-12-13 21:23:08 +01:00
|
|
|
#if LV_BUILD_EXAMPLES && LV_USE_IMAGE
|
2021-02-19 14:47:32 +01:00
|
|
|
|
|
|
|
/**
|
2021-05-27 11:50:04 +02:00
|
|
|
* Using the Size, Position and Padding style properties
|
2021-02-19 14:47:32 +01:00
|
|
|
*/
|
|
|
|
void lv_example_style_1(void)
|
|
|
|
{
|
2022-02-13 13:59:17 -05:00
|
|
|
static lv_style_t style;
|
|
|
|
lv_style_init(&style);
|
|
|
|
lv_style_set_radius(&style, 5);
|
2021-02-19 14:47:32 +01:00
|
|
|
|
2022-02-13 13:59:17 -05:00
|
|
|
/*Make a gradient*/
|
|
|
|
lv_style_set_width(&style, 150);
|
|
|
|
lv_style_set_height(&style, LV_SIZE_CONTENT);
|
2021-02-19 14:47:32 +01:00
|
|
|
|
2022-02-13 13:59:17 -05:00
|
|
|
lv_style_set_pad_ver(&style, 20);
|
|
|
|
lv_style_set_pad_left(&style, 5);
|
2021-02-19 14:47:32 +01:00
|
|
|
|
2022-02-13 13:59:17 -05:00
|
|
|
lv_style_set_x(&style, lv_pct(50));
|
|
|
|
lv_style_set_y(&style, 80);
|
2021-05-27 11:50:04 +02:00
|
|
|
|
2022-02-13 13:59:17 -05:00
|
|
|
/*Create an object with the new style*/
|
2023-10-12 20:37:27 +02:00
|
|
|
lv_obj_t * obj = lv_obj_create(lv_screen_active());
|
2022-02-13 13:59:17 -05:00
|
|
|
lv_obj_add_style(obj, &style, 0);
|
2021-05-27 11:50:04 +02:00
|
|
|
|
2022-02-13 13:59:17 -05:00
|
|
|
lv_obj_t * label = lv_label_create(obj);
|
|
|
|
lv_label_set_text(label, "Hello");
|
2021-02-19 14:47:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|