2021-04-12 18:19:04 +02:00
```eval_rst
.. include:: /header.rst
:github_url: |github_link_base|/widgets/tileview.md
```
# Tile view (lv_tileview)
## Overview
2021-05-19 13:51:22 +02:00
The Tile view is a container object where its elements (called *tiles* ) can be arranged in a grid form.
2021-04-12 18:19:04 +02:00
By swiping the user can navigate between the tiles.
2021-05-19 13:51:22 +02:00
Any direction of swiping can be disabled on the tiles individually to not allow moving from tile to an other.
2021-04-12 18:19:04 +02:00
2021-05-19 13:51:22 +02:00
If the Tile view is screen sized it gives a user interface you might have seen on the smartwatches.
2021-04-12 18:19:04 +02:00
## Parts and Styles
2021-05-19 13:51:22 +02:00
The Tile view is build from an [lv_obj ](/widgets/obj ) container and also [lv_obj ](/widgets/obj ) tiles.
2021-04-12 18:19:04 +02:00
2021-05-19 13:51:22 +02:00
The parts and styles work the same as for [lv_obj ](/widgets/obj ).
2021-04-12 18:19:04 +02:00
## Usage
2021-05-19 13:51:22 +02:00
### Add a tile
2021-04-12 18:19:04 +02:00
2021-05-19 13:51:22 +02:00
`lv_tileview_add_tile(tileview, row_id, col_id, dir)` creates a new tile on the `row_id` th row and `col_id` th column.
`dir` can be `LV_DIR_LEFT/RIGHT/TOP/BOTTOM/HOR/VER/ALL` or OR-ed values to enable moving to the adjacent tiles into the given direction with swiping.
2021-04-12 18:19:04 +02:00
2021-05-19 13:51:22 +02:00
The returned value is an `lv_obj_t *` on which the content of the tab can be created.
2021-04-12 18:19:04 +02:00
2021-05-19 13:51:22 +02:00
### Change tile
The Tile view can scroll to a tile with `lv_obj_set_tile(tileview, tile_obj, LV_ANIM_ON/OFF)` or `lv_obj_set_tile_id(tileviewv, col_id, row_id, LV_ANIM_ON/OFF);`
2021-04-12 18:19:04 +02:00
## Events
2021-05-19 13:51:22 +02:00
- `LV_EVENT_VALUE_CHANGED` Sent when a new tile loaded either with scrolling. `lv_tileview_get_tile_act(tabview)` can be used to get current tile.
2021-04-12 18:19:04 +02:00
## Keys
2021-05-19 13:51:22 +02:00
*Keys* are not handled by the Tile view.
2021-04-12 18:19:04 +02:00
Learn more about [Keys ](/overview/indev ).
## Example
```eval_rst
2021-05-19 13:51:22 +02:00
.. include:: ../../../examples/widgets/tileview/index.rst
2021-04-12 18:19:04 +02:00
```
## API
```eval_rst
.. doxygenfile:: lv_tileview.h
:project: lvgl
```