软件编程
位置:首页>> 软件编程>> Android编程>> android中TabHost的图标(48×48)和文字叠加解决方法

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

  发布时间:2023-05-19 14:13:28 

标签:tabhost,图片叠加

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

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com