Varundroid
Varundroid

Reputation: 9234

Android - How to change the default position of text and image in tabs?

Can we change the place of text and image in tabs?

Because images which i have used are slightly big in dimensions and hiding the title of my tabs.

Upvotes: 0

Views: 3410

Answers (2)

Venky
Venky

Reputation: 11107

For Changing Image and Text View in Tab Bar you need to write Custom Tab Bar. Check this link for Custom Tab Bar

Upvotes: 1

Stark
Stark

Reputation: 2611

All you have to do is increase the height of your tabs by calling tabHost.getTabWidget().getChildAt(i).getLayoutParams().height

Eg. In your main class which extends TabActivity, implement this code in your into your TabHost :

TabHost tabHost;


       for (int i = 0; i < getTabWidget().getTabCount(); i++ ) {

        tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 100;
    }

Increase the height if it's not big enough for your custom image. Happy coding!

Upvotes: 0

Related Questions