zoukankan      html  css  js  c++  java
  • 如何改变Android tab 的高度和字体大小

     1 int count = tabWidget.getChildCount();//TabHost中有一个getTabWidget()的方法
     2   for (int i = 0; i < count; i++) {
     3    View view = tabWidget.getChildTabViewAt(i);   
     4    view.getLayoutParams().height = 80; //tabWidget.getChildAt(i)
     5    final TextView tv = (TextView) view.findViewById(android.R.id.title);
     6    tv.setTextSize(28);
     7    tv.setTextColor(this.getResources().getColorStateList(
     8      android.R.color.white));
     9   }
    10 
    11 //解释二************************************************************************ 
    12 int width =45; 
    13 int height =48; 
    14 for(int i = 0; i < tabWidget.getChildCount(); i++) 
    15 { 
    16 //设置高度、宽度,不过宽度由于设置为fill_parent,在此对它没效果 
    17 tabWidget.getChildAt(i).getLayoutParams().height = height; 
    18 tabWidget.getChildAt(i).getLayoutParams().width = width; 
    19 /** 
    20 * 下面是设置Tab的背景,可以是颜色,背景图片等 
    21 */ 
    22 View v = tabWidget.getChildAt(i); 
    23 if (tabHost.getCurrentTab() == i) { 
    24 v.setBackgroundColor(Color.GREEN); 
    25 //在这里最好自己设置一个图片作为背景更好 
    26 //v.setBackgroundDrawable(getResources().getDrawable(R.drawable.chat)); 
    27 } else { 
    28 v.setBackgroundColor(Color.GRAY); 
    29 } 
    30 } 
  • 相关阅读:
    Linux下安装python
    oracle 12c使用问题总结
    oracle下载地址
    Informatica PowerCenter下载地址
    主流ETL工具
    【phonegap】下载文件
    eclipse显示包的层次关系
    UltraISO 9.6.5.3237
    Windows操作系统设置代理
    wireshark常用的过滤命令
  • 原文地址:https://www.cnblogs.com/elleniou/p/2474470.html
Copyright © 2011-2022 走看看