Can I programatically set the alpha of an ImageView without the need for being dependent on API level 11 where setAlpha was introduced?
To get α subtract your confidence level from 1. For example, if you want to be 95 percent confident that your analysis is correct, the alpha level would be 1 – . 95 = 5 percent, assuming you had a one tailed test. For two-tailed tests, divide the alpha level by 2.
For a fully opaque option i.e. 100% opacity, you do not need to use #FFC0C0C0 or #100C0C0C0(Note: this would show nothing). Just leave it as #C0C0C0 instead. The alpha channel A is a hex value, just like the RGB channels. #50C0C0C0 will give an opacity of about 30%, not 50%.
Tap the image you want to adjust. Tap Recolor to choose a filter. Tap Adjustments to adjust transparency, brightness, and contrast.
ImageView has a method setAlpha(int) since API leve 1. So you can use it in any API level.
It is the setAlpha(float) method of View which is introduced in API level 11.
I used code to setAlpha of the image itself, not the view. This is available from API level 1..
public void toggleButton(int i) {
if (indImageBtnEnabled[i]) {
int di = getDrawableId(findViewById(myImagebtns[i]));
Drawable d = this.getResources().getDrawable(di);
d.setAlpha(25);
((ImageView) findViewById(myImagebtns[i])).setImageDrawable(d);
indImageBtnEnabled[i] = false;
} else {
// findViewById(myImagebtns[i]).setAlpha(1f) << NEEDS API11;
int di = getDrawableId(findViewById(myImagebtns[i]));
Drawable d = this.getResources().getDrawable(di);
d.setAlpha(255);
((ImageView) findViewById(myImagebtns[i])).setImageDrawable(d);
indImageBtnEnabled[i] = true;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With