开发者

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

Can we chang开发者_StackOverflowe 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.


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


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜