Android textview text transparency and background transparency settings

Source: Internet
Author: User

Package net. Android. touming;

Import Android. widget. textview;
Import Android. OS. Bundle;
Import Android. View. viewgroup;
Import Android. App. activity;
Import Android. Graphics. color;
Import Android. widget. linearlayout;

Public class touming extends activity {

Final int wrap_content = viewgroup. layoutparams. wrap_content;

Public void oncreate (bundle icicle ){
Super. oncreate (icicle );

Linearlayout = new linearlayout (this );
Linearlayout. setorientation (linearlayout. Vertical );
Setcontentview (linearlayout );

Textview textview1 = new textview (this );
Textview1.settext ("All opaque = 255 ");
// Textview1.setbackgroundcolor (color. argb (255, 0,255, 0); // background transparency
Textview1.settextcolor (color. argb (255, 0,255, 0); // text transparency
Linearlayout. addview (textview1, new linearlayout. layoutparams (wrap_content,
Wrap_content ));

Textview textview2 = new textview (this );
Textview2.settext ("partial passthrough 155 ");
Textview2.setbackgroundcolor (color. argb (155, 0,255, 0); // background transparency
Textview2.settextcolor (color. argb (155, 0,255, 0); // text transparency
Linearlayout. addview (textview2, new linearlayout. layoutparams (wrap_content,
Wrap_content ));

Textview textview3 = new textview (this );
Textview3.settext ("partially transparent 55 ");
Textview3.setbackgroundcolor (color. argb (55, 0,255, 0); // background transparency
Textview3.settextcolor (color. argb (55, 0,255, 0); // text transparency
Linearlayout. addview (textview3, new linearlayout. layoutparams (wrap_content,
Wrap_content ));

Textview textview4 = new textview (this );
Textview4.settext ("all transparent 0 ");
// Textview4.setbackgroundcolor (color. argb (0, 0,255, 0); // background transparency
Textview4.settextcolor (color. argb (0, 0,255, 0); // text transparency
Linearlayout. addview (textview4, new linearlayout. layoutparams (wrap_content,
Wrap_content ));

}

}

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.