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)