---
title: "如何改变Android tab 的高度和字体大小  "
author: "Tank03"
date: "2011-12-31T10:35:47Z"
tags: ["改变Android tab 的高度和字体大小", "改变TabWidget里面字体的大小"]
categories: ["移动开发"]
slug: "android-tab"
draft: false
lastmod: "2011-12-31T10:56:45Z"
id: 1331249
url: "https://tank03.iteye.com/blog/1331249"
---

这几天由于项目原因，需要调整tab 的高度和字体大小，没少折腾人。。希望能对有此困扰的朋友，尽点绵薄之力。。如果大家找到这里来了。算是找对地方了。。哈哈哈

直接上代码，发扬分享至上的互联网精神。。。

```
 int count = tabWidget.getChildCount();
  for (int i = 0; i < count; i++) {
   View view = tabWidget.getChildTabViewAt(i);   
   view.getLayoutParams().height = 80; //tabWidget.getChildAt(i)
   final TextView tv = (TextView) view.findViewById(android.R.id.title);
   ((ImageView)view.findViewById(android.R.id.icon)).setPadding(0, -5, 0, 0);//这里是对图片的修改
   tv.setTextSize(28);
   tv.setTextColor(this.getResources().getColorStateList(
     android.R.color.white));
  }
```

 

stronger

 ！！由于没有网易的帐号,没办法感谢 Stronger.故此贴上代码以表感谢,也共享给大伙

 原贴：[http://veright.blog.163.com/blog/static/2834538920101116114716651/](http://veright.blog.163.com/blog/static/2834538920101116114716651/)