Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Make default tabs but without any content

Tags:

android

tabs

view

So I want to have tabs with default style but I want to handle content by myself. If I try to create them only with:

TabSpec tabT = mainTabHost.newTabSpec("tabT").setIndicator("T"); tabHost.add(tabT);

I get error that content is not specified.

Then I tried to add tabs with tabwidget directly but I don't know how to get default style of tabs.

Any advice?

like image 717
Gapipro Avatar asked Jun 24 '11 14:06

Gapipro


1 Answers

Try TabContentFactory with an empty View:

tabSpec.setContent(new EmptyTabFactory());

the factory class:

private class EmptyTabFactory implements TabContentFactory {

    @Override
    public View createTabContent(String tag) {
        return new View(mContext);
    }

}
like image 60
whlk Avatar answered Oct 16 '22 01:10

whlk