TabLayout

Screenshot

Tablayout - Reference - Enaml-native - CodeLV

Example

from enamlnative.core.api import *
from enamlnative.widgets.api import *

enamldef ContentView(Flexbox):
    flex_direction = "column"
    ViewPager:
        TabLayout: tab_layout:
            attr placement = 'top'
            gravity << placement
            tab_color = '#7fff'
            tab_color_selected = '#fff'
            background_color = '#3574a3'
        Looper:
            iterable << ['First', 'Second', 'Third']
            TabFragment:
                title = loop_item
                Flexbox:
                    background_color = '#fff'
                    flex_direction = 'column'
                    padding = (10,10,10,10)
                    Spinner:
                        items = ['top', 'bottom']
                        selected << 0 if tab_layout.placement == 'top' else 1
                        selected :: tab_layout.placement = self.items[self.selected]
                    TextView:
                        text = "Tab modes"
                    Spinner:
                        items = ['fixed','scrollable']
                        selected << 0 if tab_layout.tab_mode == 'fixed' else 1
                        selected :: tab_layout.tab_mode = self.items[self.selected]
                    TextView:
                        text = "Tab gravity"
                    Spinner:
                        items = ['fill', 'center']
                        selected << 0 if tab_layout.tab_gravity == 'fill' else 1
                        selected :: tab_layout.tab_gravity = self.items[self.selected]

Declaration

class enamlnative.widgets.tab_layout.TabLayout(parent=None, **kwargs)[source]

Bases: enamlnative.widgets.frame_layout.FrameLayout

A TabLayout contains a tab for each TabFragment child of a ViewPager

tab_mode

Set the behavior mode for the Tabs in this layout.

tab_gravity

Set the gravity to use when laying out the tabs.

tab_indicator_color_selected

Sets the tab indicator’s color for the currently selected tab.

tab_indicator_height

Sets the tab indicator’s height for the currently selected tab.

tab_color

Tab normal color

tab_color_selected

Tab color selected

current_tab

Currently selected tab title

proxy

A reference to the ProxyLabel object.

Android Implementation

class enamlnative.android.android_tab_layout.AndroidTabLayout[source]

Bases: enamlnative.android.android_frame_layout.AndroidFrameLayout, enamlnative.widgets.tab_layout.ProxyTabLayout

An Android implementation of an Enaml ProxyTabLayout.

widget

A reference to the widget created by the proxy.

tabs

Save created tab spec references

create_widget()[source]

Create the underlying widget.

init_widget()[source]

Initialize the underlying widget.

destroy()[source]

Destroy all tabs when destroyed

No iOS implementation found.