lv_tabview.h

Functions

lv_obj_t *lv_tabview_create(lv_obj_t *parent)

Create a tabview widget

参数:

parent -- pointer to a parent widget

返回:

the created tabview

lv_obj_t *lv_tabview_add_tab(lv_obj_t *obj, const char *name)

Add a tab to the tabview

参数:
  • obj -- pointer to a tabview widget

  • name -- the name of the tab, it will be displayed on the tab bar

返回:

the widget where the content of the tab can be created

void lv_tabview_rename_tab(lv_obj_t *obj, uint32_t idx, const char *new_name)

Change the name of the tab

参数:
  • obj -- pointer to a tabview widget

  • idx -- the index of the tab to rename

  • new_name -- the new name as a string

void lv_tabview_set_active(lv_obj_t *obj, uint32_t idx, lv_anim_enable_t anim_en)

Show a tab

参数:
  • obj -- pointer to a tabview widget

  • idx -- the index of the tab to show

  • anim_en -- LV_ANIM_ON/OFF

void lv_tabview_set_tab_bar_position(lv_obj_t *obj, lv_dir_t dir)

Set the position of the tab bar

参数:
  • obj -- pointer to a tabview widget

  • dir -- LV_DIR_TOP/BOTTOM/LEFT/RIGHT

void lv_tabview_set_tab_bar_size(lv_obj_t *obj, int32_t size)

Set the width or height of the tab bar

参数:

size -- size of the tab bar in pixels or percentage. will be used as width or height based on the position of the tab bar)

uint32_t lv_tabview_get_tab_count(lv_obj_t *obj)

Get the number of tabs

参数:

obj -- pointer to a tabview widget

返回:

the number of tabs

uint32_t lv_tabview_get_tab_active(lv_obj_t *obj)

Get the current tab's index

参数:

obj -- pointer to a tabview widget

返回:

the zero based indoex of the current tab

lv_obj_t *lv_tabview_get_content(lv_obj_t *obj)

Get the widget where the container of each tab is created

参数:

obj -- pointer to a tabview widget

返回:

the main container widget

lv_obj_t *lv_tabview_get_tab_bar(lv_obj_t *obj)

Get the tab bar where the buttons are created

参数:

obj -- pointer to a tabview widget

返回:

the tabbar

Variables

const lv_obj_class_t lv_tabview_class
struct lv_tabview_t

Public Members

lv_obj_t obj
uint32_t tab_cur
lv_dir_t tab_pos