·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> app软件开发 >> Android开发 >> android中TabHost的图标(48×48)和文字叠加解决方法

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

作者:佚名      Android开发编辑:admin      更新时间:2022-07-23

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