Android icon coloring to save the APK volume, there are many online introduction, the use is very simple
<imageview android:tint= "@android: Color/white" android:backgroundtint= "@android: Color/black"/>
Usually use this way, you have to change the code today, so record
First Kind
Drawable icon;if (Android.os.Build.VERSION.SDK_INT < Android.os.Build.VERSION_CODES. LOLLIPOP) {icon = Getresources (). getdrawable (R.drawable.ic_back_black);} else{icon = getresources (). getdrawable (R.drawable.ic_back_black, Gettheme ());} Colorfilter filter = new Lightingcolorfilter (Color.White, Color.White); Icon.setcolorfilter (filter); Image.setimagedrawable (icon);
The second kind, need V4 package
Drawable icon1;if (Android.os.Build.VERSION.SDK_INT < Android.os.Build.VERSION_CODES. LOLLIPOP) {icon1 = Getresources (). getdrawable (R.drawable.ic_back_black);} else{Icon1 = Getresources (). getdrawable (R.drawable.ic_back_black, Gettheme ());} drawable Tinticon = Drawablecompat.wrap (icon1);D rawablecompat.settint (Tinticon, color.white);// Drawablecompat.settintlist (Tinticon, Color.White); titleback1.setimagedrawable (Tinticon);
Well, all two can be achieved. I don't know which one is better.
There are a lot of related information online
Http://www.cnblogs.com/helloandroid/p/4779061.html
Http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2016/0128/3923.html
This article is from the "Fly to learn Android" blog, please be sure to keep this source http://qq445493481.blog.51cto.com/9545543/1842972
Android changes the picture background color tint (shading) or backgroundtint