JayVDiyk
JayVDiyk

Reputation: 4487

Alpha Value changes makes color become black

    imageView.setColorFilter(Color.argb(255, 255, 255, 255));

I would like to change the alpha value to 10 percent (25) like this.

    imageView.setColorFilter(Color.argb(25, 255, 255, 255));

But the color become black rather than transparent white. Any thoughts?

Upvotes: 0

Views: 839

Answers (3)

Ram Mandal
Ram Mandal

Reputation: 1959

agree with @RRR you can use this too

define trans_black in color.xml with code #1A000000

ImageView logoImage = (ImageView) findViewById(R.id.logo);
logoImage.setColorFilter(getApplicationContext().getResources().getColor(R.color.trans_black));

Upvotes: 1

Josh.M
Josh.M

Reputation: 103

Set a mode. setColorFilter(Color.argb(25, 255, 255, 255),PorterDuff.Mode.MULTIPLY);

Upvotes: 1

Ravi
Ravi

Reputation: 35549

you can use Color.parseColor and give transparency in hexa code

imageView.setColorFilter(Color.parseColor("#1AFFFFFF"));

here first 2 letters 1A is your transparency code.

for more transparency code check this

Upvotes: 1

Related Questions