This is my code:
backPic.setScaleType(ImageView.ScaleType.FIT_CENTER);
backPic.setColorFilter(ContextCompat.getColor(context, R.color.red), android.graphics.PorterDuff.Mode.MULTIPLY);
Picasso.with(context).load(icon).into(backPic, new com.squareup.picasso.Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
UserVehicle.setVehicleClassPic(getVclass().getId(), backPic);
}
});
The initial picture is this:
This is what I get now:
How can I make it so the bike in the second picture is red, not gray towards green?
The color I sent to the image filter is red.
Using the comment from André Sousa I did this code:
Picasso.with(context).load(icon).into(backPic, new com.squareup.picasso.Callback() {
@Override
public void onSuccess() {
DrawableCompat.setTint(backPic.getDrawable(), context.getResources().getColor(R.color.red));
}
@Override
public void onError() {
UserVehicle.setVehicleClassPic(getVclass().getId(), backPic);
}
});
So it would set the tint after the Picasso image has loaded, which works