Search code examples
androidimagetexttabsandroid-tabhost

On an Android tab, how to show the text under the image?


I have an Android application that uses tabs. I already have the tabs, and the Activities correctly on the application. My problem is that, when I add the text and image on the tab, the text appears over the image.(EXAMPLE) What I want is the text to appear bellow the image. This happens either if I use the image or a selector. I use this code to add the tab to the tabHost:

// Do the same for the other tabs
intent = new Intent().setClass(this, CategoryListActivity.class);
spec = tabHost.newTabSpec(getString(R.string.category_title)).setIndicator(getString(R.string.category_title), res.getDrawable(R.drawable.ic_category)).setContent(intent);
tabHost.addTab(spec);

Any ideas on how I can fix this?


Solution

  • I think the default behaviour is that (see some example here: http://mobileorchard.com/android-app-development-tabbed-activities/)

    The recommended tab images are darkish to avoid that, using white and grey as font color.

    To change that you will have to create custom tabs:

    Custom tabs in android