Android resource file access and usage

Source: Internet
Author: User

    /*** How to set the color of layout control in code * Reference: *http://yahaitt.iteye.com/blog/454615     *  http://blog.csdn.net/fantianheyey/article/details/9208771     *  http://txlong-onz.iteye.com/blog/1249609     *  http://my.oschina.net/u/2320057/blog/549507     *  http://blog.csdn.net/shulianghan/article/details/19913755     */@Override Public voidInitdatas () {//system comes with the color classTvcolortext.settextcolor (Color.green); //0XFFFF00FF is the data of type int, group the 0x|ff|ff00ff,0x is the mark that represents the color integer, FF is the transparency,//FF00FF represents color, note: Here 0xff-ff-00-ff must be 8 color representation, do not accept ff00ff this 6 color representation. Tvcolortext.settextcolor (0xFFCCCCCC); Tvcolortext.settextcolor (Color.rgb (55, 55, 55)); Tvcolortext.settextcolor (Color.parsecolor ("#87CEFA")); //set up by getting a resource file//can reference a color attribute in a resource file//<color name= "Red" > #FF0000 </color>//<drawable name= "Red" > #FF0000 </drawable>//<string name= "Red" > #FF0000 </string>Tvcolortext.settextcolor (Getresources (). GetColor (r.color.coloraccent)); }

Android resource file access and usage

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.