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

Genet ·
更新时间:2024-09-20
· 727 次阅读

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

您可能感兴趣的文章:Android TabHost选项卡标签图标始终不出现的解决方法Android组件TabHost实现页面中多个选项卡切换效果android TabHost(选项卡)的使用方法android 选项卡(TabHost)如何放置在屏幕的底部Android控件之TabHost用法实例分析Android TabLayout(选项卡布局)简单用法实例分析Android实现底部导航栏功能(选项卡)Android多个TAB选项卡切换效果Android仿微信底部实现Tab选项卡切换效果Android开发之TabHost选项卡及相关疑难解决方法



方法 tabhost Android

需要 登录 后方可回复, 如果你还没有账号请 注册新账号
相关文章