feat(xml): add the basics of declarative XML support
This commit is contained in:
37
examples/others/xml/lv_example_xml_1.c
Normal file
37
examples/others/xml/lv_example_xml_1.c
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_BUILD_EXAMPLES && LV_USE_XML
|
||||
|
||||
void lv_example_xml_1(void)
|
||||
{
|
||||
lv_xml_component_register_from_file("A:lvgl/examples/others/xml/my_h3.xml");
|
||||
lv_xml_component_register_from_file("A:lvgl/examples/others/xml/my_card.xml");
|
||||
lv_xml_component_register_from_file("A:lvgl/examples/others/xml/my_button.xml");
|
||||
lv_xml_component_register_from_file("A:lvgl/examples/others/xml/view.xml");
|
||||
|
||||
lv_obj_t * obj = lv_xml_create(lv_screen_active(), "view", NULL);
|
||||
lv_obj_set_pos(obj, 10, 10);
|
||||
|
||||
const char * my_button_attrs[] = {
|
||||
"x", "10",
|
||||
"y", "-10",
|
||||
"align", "bottom_left",
|
||||
"btn_text", "New button",
|
||||
NULL, NULL,
|
||||
};
|
||||
|
||||
lv_xml_component_unregister("my_button");
|
||||
|
||||
lv_xml_create(lv_screen_active(), "my_button", my_button_attrs);
|
||||
|
||||
const char * slider_attrs[] = {
|
||||
"x", "200",
|
||||
"y", "-15",
|
||||
"align", "bottom_left",
|
||||
"value", "30",
|
||||
NULL, NULL,
|
||||
};
|
||||
|
||||
lv_obj_t * slider = lv_xml_create(lv_screen_active(), "lv_slider", slider_attrs);
|
||||
lv_obj_set_width(slider, 100);
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user