Skip to content
This repository was archived by the owner on Apr 30, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public class MaterialTabHost extends RelativeLayout implements View.OnClickListe
private boolean isTablet;
private float density;
private boolean scrollable;
private boolean forceFixed;
private boolean forceScrollable;

private HorizontalScrollView scrollView;
private LinearLayout layout;
Expand Down Expand Up @@ -132,6 +134,24 @@ public void setIconColor(int color) {
tab.setIconColor(color);
}
}

public void setForceFixed(boolean force) {
this.forceFixed = force;

if (force) {
forceScrollable = false;
scrollable = false;
}
}

public void setForceScrollable(boolean force) {
this.forceScrollable = force;

if (force) {
forceFixed = false;
scrollable = true;
}
}

public void addTab(MaterialTab tab) {
// add properties to tab
Expand All @@ -144,12 +164,12 @@ public void addTab(MaterialTab tab) {
// insert new tab in list
tabs.add(tab);

if(tabs.size() == 4 && !hasIcons) {
if(tabs.size() == 4 && !hasIcons && !forceFixed) {
// switch tabs to scrollable before its draw
scrollable = true;
}

if(tabs.size() == 6 && hasIcons) {
if(tabs.size() == 6 && hasIcons && !forceFixed) {
scrollable = true;
}
}
Expand Down