I would like to draw a half-transparent rectangle onto the canvas of my view. I did it like this:
Using java Syntax Highlighting
- paint.setColor(Color.argb(200, 255, 255, 255));
- canvas.drawRect(0, 0, getWidth(),70, paint);
Parsed in 0.013 seconds, using GeSHi 1.0.8.4
This is what the documentation says about Color.argb():
Return a color-int from alpha, red, green, blue components. These component values should be [0..255], but there is no range check performed, so if they are out of range, the returned color is undefined.
Parameters
alpha Alpha component [0..255] of the color
red Red component [0..255] of the color
green Green component [0..255] of the color
blue Blue component [0..255] of the color
This works on some phones, on others it just draws nothing.
Do you have an idea why?