Compatible implementations of Tint (shader)

Source: Internet
Author: User

When we do the controls, we can use the Tint property to color the controls, which in many cases can reduce the color of the resources of different colors. In MD design, the color of the control as the subject changes is also a big point, today we will look at how to use it.

To use steps: 1. Create a control; 2. Use viewcompat.setbackgroundtintlist

  //      first implementation        New Colorstatelist (newint[][]{newintnewint []{0xffffcc00 });        Viewcompat.setbackgroundtintlist (Pasteet, cl);         // The second kind of implementation        Viewcompat.setbackgroundtintlist (Pasteet, Getresources (). Getcolorstatelist (r.color.red));

What is the colorstatelist here, if you have done a property customization of the classmate must have seen it, it is a color XML file, here the color I used the simplest way to define:

<name= "Red">#ff0000</color>

We also sometimes define colors in different states like selector, and eventually the XML files are converted to colorstatelist objects, which preserve the state and presentation values in different states.

Reference from:

http://segmentfault.com/a/1190000003038675?utm_source=Weibo&utm_medium=shareLink&utm_campaign= Socialshare

Http://stackoverflow.com/questions/27735890/lollipops-backgroundtint-has-no-effect-on-a-button

Compatible implementations of Tint (shader)

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.