TabHost-整合标签中图片和文字的位置
TabHost--调整标签中图片和文字的位置
TabHost的Lab如果使用32x32的图片是没有这个问题的,使用稍大如48x48就有问题了,这里通过调整坐标和缩小字体来解决这个问题。
调整代码:
View view = this.getTabWidget().getChildAt(0); ((TextView)view.findViewById(android.R.id.title)).setTextSize(12);//设置字体 ((ImageView)view.findViewById(android.R.id.icon)).setPadding(0, -5, 0, 0);//设置补白系数
代码说明:
a). 这里使用系统默认的容器 com.android.internal.R.layout.tab_content,title和icon为系统内置的id号。