public class

TabLayout

extends Layout
java.lang.Object
   ↳ com.neomades.ui.View
     ↳ com.neomades.ui.Layout
       ↳ com.neomades.ui.TabLayout

Class Overview

A TabLayout represents a layout with many tabs.

Cross-Platform rendering

In iOS, a SegmentedView is displayed at the top of the layout in order to switch between tabs.

In Android, a TabBar is displayed at the top of the layout.

Image sizes

  • iOS: 30 x 30 pixels (low resolutions) and 60 x 60 pixels (high resolutions)
  • Android: 24 x 24 pixels (ldpi), 32 x 32 pixels (mdpi), 48 x 48 pixels (hdpi), 64 x 64 pixels (xhdpi)

Summary

XML Attributes
Attribute Name Related Method Description
currentTab setCurrentTab(int) The selected tab  
[Expand]
Inherited XML Attributes
From class com.neomades.ui.View
Constants
int STYLE_BAR The iOS small toolbar style for segmented controls.
int STYLE_BEZELED The iOS large bezeled style for segmented controls.
int STYLE_BORDERED The iOS large bordered style for segmented controls.
int STYLE_PLAIN The iOS large plain style for segmented controls.
[Expand]
Inherited Constants
From interface com.neomades.ui.Alignment
From interface com.neomades.ui.StretchMode
Public Constructors
TabLayout()
Constructs an empty tab layout, with no tab.
Public Methods
void addTab(String txt, Image img, View content)
Add a tab to this tab layout
void addTab(String txt, View content)
Add a tab to this tab layout
void addTab(int txtId, int imgId, View content)
Add a tab to this tab layout
void addTab(Image img, View content)
Add a tab to this tab layout
int getCurrentTab()
Get the current selected tab.
void setCurrentTab(int number)
Changes the current selected tab
void setStyle(int style)
Sets the style of the segmented view for tabs in iOS.
[Expand]
Inherited Methods
From class com.neomades.ui.Layout
From class com.neomades.ui.View
From class java.lang.Object

XML Attributes

currentTab

The selected tab

Related Methods

Constants

public static final int STYLE_BAR

The iOS small toolbar style for segmented controls. Segmented controls in this style can have a tint color.

Constant Value: -3 (0xfffffffd)

public static final int STYLE_BEZELED

The iOS large bezeled style for segmented controls. Segmented controls in this style can have a tint color

Constant Value: -4 (0xfffffffc)

public static final int STYLE_BORDERED

The iOS large bordered style for segmented controls.

Constant Value: -2 (0xfffffffe)

public static final int STYLE_PLAIN

The iOS large plain style for segmented controls. This style is the default.

Constant Value: -1 (0xffffffff)

Public Constructors

public TabLayout ()

Constructs an empty tab layout, with no tab.

Public Methods

public void addTab (String txt, Image img, View content)

Add a tab to this tab layout

Parameters
txt The title of the tab
img The image of the tab, that will be displayed near the title
content The content of the tab
Throws
CrossThreadException if the method is called from outside the UI-Thread
IllegalStateException if the layout has already a parent

public void addTab (String txt, View content)

Add a tab to this tab layout

Parameters
txt The title of the tab
content The content of the tab
Throws
CrossThreadException if the method is called from outside the UI-Thread
IllegalStateException if the layout has already a parent

public void addTab (int txtId, int imgId, View content)

Add a tab to this tab layout

Parameters
txtId the string id of the tab's title
imgId the image id of the tab
content The content of the tab
Throws
CrossThreadException if the method is called from outside the UI-Thread
IllegalStateException if the layout has already a parent

public void addTab (Image img, View content)

Add a tab to this tab layout

Parameters
img The image of the tab, that will be displayed instead of the title
content The content of the tab
Throws
CrossThreadException if the method is called from outside the UI-Thread
IllegalStateException if the layout has already a parent

public int getCurrentTab ()

Get the current selected tab.

Related XML Attributes
Returns
  • the integer value of the selected tab

public void setCurrentTab (int number)

Changes the current selected tab

Related XML Attributes
Parameters
number current tab index
Throws
CrossThreadException if the method is called from outside the UI-Thread

public void setStyle (int style)

Sets the style of the segmented view for tabs in iOS.

Parameters
style one of STYLE_BAR, STYLE_BEZELED, STYLE_BORDERED or STYLE_PLAIN