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

 更新时间:2013年01月21日 11:52:18   作者:  
开发过程中,有时候图标稍微大点,比如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); }

相关文章

最新评论