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)