不希望我的TabWidget图标 [英] Don't want icons on my TabWidget

查看:83
本文介绍了不希望我的TabWidget图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还在学习关于An​​droid,一边摆弄 TabHost TabWidget ,我不能帮助,但请注意,有没有选择关闭图标。

I'm still learning about Android, and while playing around with TabHost and TabWidget, I can't help but notice that there's no option to turn off the icons.

它吃起来,即使我不实际设置的图标到则tabspec 宝贵的空间。请问有什么办法可以减少标签栏的高度?这真的很难找到小图标(在3个不同大小)完全适合我故意这些标签包含。我有零技能的图形。

It's eating up valuable space even when I don't actually set an icon into the TabSpec. Is there any way to reduce the height of the tab bar? It's really hard to find small icons (at 3 different sizes) that perfectly fits what I intended those tabs to contain. I have zero skills with graphics.

推荐答案

我有这样的:

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

添加code添加标签为标签的主机...然后最后

Add code to add tabs into tab host... 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 pics) results in this:

它看起来像35是一个不错的数字。也许它需要针对不同的DPI进行更改。

It looks like 35 is a good number.. Perhaps it needs to be changed for different dpi.

这篇关于不希望我的TabWidget图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆