Alpha doen's work

Problems with Canvas, OpenGL, etc...

Alpha doen's work

Postby georgwiese » Thu Apr 14, 2011 4:10 pm

I would like to draw a half-transparent rectangle onto the canvas of my view. I did it like this:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. paint.setColor(Color.argb(200, 255, 255, 255));
  2. canvas.drawRect(0, 0, getWidth(),70, paint);
Parsed in 0.013 seconds, using GeSHi

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.

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?
Experienced Developer
Experienced Developer
Posts: 70
Joined: Mon May 03, 2010 7:14 pm


Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 4 guests