I use visual studio built my project and with PC as simulate monitor.
When I use diferent theme in my project,I fond the tileview widget can’t align left screen
I want to cry use the liitlevgl come across unexpected problems
my code as follow
void task(void)
{
hres = lv_disp_get_hor_res(NULL);
vres = lv_disp_get_ver_res(NULL);
/*Initial the display theme*/
//lv_theme_t * th= lv_theme_mono_init(210, NULL);
//th->style.bg->body.main_color = LV_COLOR_BLACK;
//th->style.bg->body.grad_color = LV_COLOR_BLACK;
//lv_theme_set_current(th);
lv_theme_t* th = lv_theme_alien_init(10, NULL);
th->style.bg->body.main_color = lv_color_make(0, 0, 0);
th->style.bg->body.grad_color = lv_color_make(0, 0, 0);
lv_theme_set_current(th);
MainmenuCreate();
}
/***********************************************
different them
***********************************************/
void task(void)
{
hres = lv_disp_get_hor_res(NULL);
vres = lv_disp_get_ver_res(NULL);
/*Initial the display theme*/
lv_theme_t * th= lv_theme_mono_init(210, NULL); //This lv_theme_mono_init(210, NULL)
th->style.bg->body.main_color = LV_COLOR_BLACK;//If delete this set the animation can't create
th->style.bg->body.grad_color = LV_COLOR_BLACK;
lv_theme_set_current(th);
//lv_theme_t* th = lv_theme_alien_init(10, NULL);
//th->style.bg->body.main_color = lv_color_make(0, 0, 0);
//th->style.bg->body.grad_color = lv_color_make(0, 0, 0);
//lv_theme_set_current(th);
MainmenuCreate();
}
/***********************************************/
void MainmenuCreate(void)
{
lv_coord_t hres = lv_disp_get_hor_res(NULL);
lv_coord_t vres = lv_disp_get_ver_res(NULL);
static const lv_point_t validPos[] = {
{ 0, 0 },
{ 0, 1 },
{ 0, 2 },
{ 0, 3 },
{ 0, 4 },
{ 0, 5 },
{ 0, 6 },
{ 0, 7 },
{ 0, 8 },
{ 0, 9 },
{ 0, 10 }
};
tileview = lv_tileview_create(lv_scr_act(), NULL);
lv_tileview_set_valid_positions(tileview, validPos, sizeof(validPos) / sizeof(validPos[0]));
lv_obj_set_size(tileview, hres, vres);
lv_page_set_sb_mode(tileview, LV_SB_MODE_OFF);
lv_obj_t *firstTile = lv_obj_create(tileview, NULL);
lv_obj_set_size(firstTile, hres, vres);
lv_obj_set_click(firstTile, true);
lv_obj_set_event_cb(firstTile, TileEventHandler);
lv_tileview_add_element(tileview, firstTile);
tilesDsc[TILE_FIRST].handle = firstTile;
for (uint16_t i = TILE_TIME; i <= TILE_LAST; ++i) {
lv_obj_t *tile = lv_obj_create(tileview, firstTile);
lv_obj_set_pos(tile, 0, i * vres);
lv_tileview_add_element(tileview, tile);
TileDsc *dsc = &tilesDsc[i];
dsc->handle = tile;
if (dsc->setup != NULL) {
dsc->setup(tile);
}
}
lv_obj_set_event_cb(tileview, TileviewEventHandler);
lv_tileview_set_tile_act(tileview, 0, 1, true);
}
/*****************************************************************/
I don’t know why the same function in different them can’t align left.