Simon
Simon

Reputation: 43

How to set dragshadow opacity in java - android?

I use a Drawable with a .png image resource. The issue is that when the image is dragged, its opacity is lowered.

I would like the image opacity to be 100%.

I found that you can use getOpacity() on Drawable, but cannot seem to find a way to set it.

Is there any way to set this?

Upvotes: 0

Views: 210

Answers (1)

ShihabSoft
ShihabSoft

Reputation: 835

You can simply use this.

Drawable rightArrow = getResources().getDrawable(R.drawable.green_arrow_right_small);//Loads an image from resource.

// setting the opacity (alpha)
rightArrow.setAlpha(10);

// setting the images on the ImageViews
rightImage.setImageDrawable(rightArrow);

Upvotes: 1

Related Questions