Don't want the icons on my TabWidget

I am still learning Android, and while playing with TabHostand TabWidgetI cannot help but notice that there is no way to turn off the icons.

It eats up valuable space even when I don't actually set the icon in TabSpec. Is there a way to reduce the height of the tab bar? It is very difficult to find small icons (in 3 different sizes) that are perfect for what I wanted to use for these tabs. I have zero graphics skills.

+5
source share
2 answers

I have it:

        TabHost tabHost = getTabHost();  // The activity TabHost

Add code to add tabs to the host tab ... and then finally

        tabHost.getTabWidget().getChildAt(0).getLayoutParams().height = 25;
        tabHost.getTabWidget().getChildAt(1).getLayoutParams().height = 30;
        tabHost.getTabWidget().getChildAt(2).getLayoutParams().height = 35;
        tabHost.getTabWidget().getChildAt(3).getLayoutParams().height = 50;

Which (if you do not have a photo), it turns out the following: alt text

, 35 - . , dpi.

+13

getTabHost().getTabWidget().getChildAt(0).setHeight(10)

+1

All Articles