首页 > 系统 > Android > 正文

android中TabHost的图标(48×48)和文字叠加解决方法

2019-10-24 21:06:39
字体:
来源:转载
供稿:网友
开发过程中,有时候图标稍微大点,比如48×48的时候,文字就会和图标叠加起来,遇到这种问题我们该怎样处理呢?本文将详细介绍希望对你有所帮助
 

开发过程中,有时候图标稍微大点,比如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); } 

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表