Android 5.0 new features learn--drawable tinting (coloring for picture resources)

Source: Internet
Author: User

Use the Android:tint property to adjust the hue.
Android:tintmode Shading Mode
Screen
Multiply
and
Src_atop/src_in/src_over
Settint (int tint)
Settint (int tint) parameter, can be a @color/under the property, or it can be an XML in the Selector,selector item is using the number of the

<selectorxmlns:android= "Http://schemas.android.com/apk/res/android"><Itemandroid:state_focused= "true"Android:color= "@color/testcolor1"/><Itemandroid:state_pressed= "true"android:state_enabled= "false"Android:color= "@color/testcolor2" /><Itemandroid:state_enabled= "false"Android:color= "@color/testcolor3" /><ItemAndroid:color= "@color/testcolor5"/></selector>

Setcolorfilter set shading color and shading mode at the same time

To draw a color from a picture:
There is a android-support-v7-palette.jar in the SUPPORT-V7 library on API21 that allows you to extract some prominent colors from the image:
Palette p = palette.generate (Bitmap Bitmap);
• Vivid P.getvibrantcolor (int defaultcolor);
• Vivid Dark P.getdarkvibrantcolor (int defaultcolor);
• Vivid bright P.getlightvibrantcolor (int defaultcolor);
• Soft P.getmutedcolor (int defaultcolor);
• Soft Dark P.getdarkmutedcolor (int defaultcolor);
• Soft bright P.getlightmutedcolor (int defaultcolor);
Palette.generate (), used in a background thread, can use Palette.generateasync () if the Palette object is created in the foreground thread.

Android 5.0 new features learn--drawable tinting (coloring for picture resources)

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.