html5中文学习网

您的位置: 首页 > android » 正文

android中TabHost的图标(48×48)和文字叠加解决方法_Android_脚本之家

[ ] 已经帮助:人解决问题

开发过程中,有时候图标稍微大点,比如48×48的时候,文字就会和图标叠加起来,解决方法如下:

复制代码 代码如下:

TabWidget tw = tabHost.getTabWidget();
for (int i = 0; i < tw.getChildCount(); i++)
{    
TextView tv=(TextView)tw.getChildAt(i).findViewById(android.R.id.title);    
ImageView iv=(ImageView)tw.getChildAt(i).findViewById(android.R.id.icon);    
iv.setPadding(0, -8, 0, 0);    
tv.setPadding(0, 0, 0, -2);    
tv.setTextSize(12); }

(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助