Tabview(选项卡) (lv_tabview)

Overview(概述)

显示原文

The Tab view object can be used to organize content in tabs. The Tab view is built from other widgets:

The tab buttons can be positioned on the top, bottom, left and right side of the Tab view.

A new tab can be selected either by clicking on a tab button or by sliding horizontally on the content.


Tabview(选项卡)对象可用于组织选项卡中的内容。选项卡对象是由其他控件组件而成的:

  • 主容器:Base Widget

  • 选项卡按钮:一个带有:ref:lv_button`的:ref:`base_widget

  • 选项卡的容器:Base Widget

  • 选项卡的内容:Base Widget

选项卡栏可以位于选项卡控件的顶部、底部、左侧和右侧。

可以通过单击选项卡栏中的按钮或在选项卡标签上水平滑动来切换选项卡标签。

Parts and Styles(部分和样式)

显示原文

There are no special parts on the Tab view but the Base Widget and Button(按钮) (lv_button) widgets are used to create the Tab view.


选项卡上没有特殊部分,但 Base WidgetButton(按钮) (lv_button) 控件用于创建选项卡。

Usage(用法)

Create a Tab view(创建选项卡)

显示原文

lv_tabview_create(parent) creates a new empty Tab view.


lv_tabview_create(parent) 创建一个新的空选项卡。

Add tabs(添加选项卡标签)

显示原文

New tabs can be added with lv_tabview_add_tab(tabview, "Tab name"). This will return a pointer to a Base Widget where the tab's content can be created.


可以使用函数 lv_tabview_add_tab(tabview, "Tab name") 添加一个新的选项卡标签。 这将返回一个指向:ref:`base_widget`的指针,可在该部件上创建选项卡的内容。

Rename tabs(重命名选项卡标签)

显示原文

A tab can be renamed with lv_tabview_rename_tab(tabview, tab_id, "New Name").


可以使用函数 lv_tabview_rename_tab(tabview, tab_id, "New Name") 重命名选项卡标签。

Change tab(切换选项卡标签)

显示原文

To select a new tab you can:


可以通过下面的方式切换到其他选项卡标签:

Set tab bar position(设置选项卡栏位置)

显示原文

Using the lv_tabview_set_tab_bar_position(tabview, LV_DIR_LEFT / RIGHT / TOP / BOTTOM) the tab bar can be moved to any sides.


使用函数 lv_tabview_set_tab_bar_position(tabview, LV_DIR_LEFT / RIGHT / TOP / BOTTOM) 选项卡栏可以移动到任何一侧。

Set tab bar size(设置选项卡栏大小)

显示原文

The size of the tab bar can be adjusted by lv_tabview_set_tab_bar_size(tabview, size) In case of vertical arrangement is means the height of the tab bar, and in horizontal arrangement it means the width.


选项卡栏的大小可以通过函数 lv_tabview_set_tab_bar_size(tabview, size) 来调整。对于参数 size ,如果选项卡栏是垂直摆放,则表示高度;如果选项卡栏是水平排列,则表示宽度。

Get the parts(获取部分)

显示原文

Events(事件)

显示原文

Further Reading

Learn more about Base-Widget Events emitted by all Widgets.

Learn more about Events(事件).


了解更多关于所有部件发出的:ref:`lv_obj_events`(可参考对应引用内容)的相关内容。

了解更多关于:ref:`events`的相关内容。

Keys(按键)

显示原文

Keys have effect only on the tab buttons. Add manually to a group if required.

Learn more about Keys(按键).


按键仅对选项卡栏中的按钮有效。如果需要,请手动添加到组。

阅读了解有关 Keys(按键) 的更多信息。

Example

Simple Tabview


Tabs on the left, styling and no scrolling


API

lv_tabview.h

lv_types.h

lv_api_map_v8.h