How to change the height and font size of the android Tab

Source: Internet
Author: User
1   Int Count = tabwidget. getchildcount (); //  There is a gettabwidget () method in tabhost.  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  //  2 ************************************** **********************************  12   Int Width = 45 ;  13   Int Height = 48 ;  14   For ( Int I = 0; I <tabwidget. getchildcount (); I ++ )  15   {  16  //  Set the height and width, but the width is not effective here because it is set to fill_parent.  17 Tabwidget. getchildat (I). getlayoutparams (). Height = Height;  18 Tabwidget. getchildat (I). getlayoutparams (). width = Width;  19   /**   20   * The following shows the tab background, which can be color or background image.  21   */   22 View v = Tabwidget. getchildat (I ); 23   If (Tabhost. getcurrenttab () = I ){  24   V. setbackgroundcolor (color. Green );  25   //  It is better to set an image as the background here.  26   //  V. setbackgrounddrawable (getresources (). getdrawable (R. drawable. Chat ));  27 } Else  {  28  V. setbackgroundcolor (color. Gray );  29   }  30 }

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.