Here's how I do this: It's pulling the color from a resource xml file.
<resources>
<color name="new_color">#FFAAAAAA</color>
</resources>
In your activity .java file:
import android.graphics.PorterDuff.Mode;
Resources res = context.getResources();
final ImageView image = (ImageView) findViewById(R.id.imageId);
final int newColor = res.getColor(R.color.new_color);
image.setColorFilter(newColor, Mode.SRC_ATOP);
To clear it call:
image.setColorFilter(null);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…