Reputation: 123
I have created a pie chart SurfaceView component. When I set the background colour to #fff0f0f0 the colour on the screen has a pink tinge to it. When I take a screenshot of the image and load it into an paint package the hex colour value is f7f3f7. I'm using the following code to clear the background;
int backgroundColour = getResources().getColor(R.color.grey);
Paint colour = new Paint();
colour.setAntiAlias(true);
colour.setColor(backgroundColour);
canvas.drawColor(colour.getColor());
This is called just after I call;
surfaceHolder.lockCanvas(null)
I cannot figure out what is causing this problem. The alpha channel is set to FF so there shouldn't be anything showing through from behind.
Just to note I have tried with and without the Alpha channel
Upvotes: 0
Views: 910
Reputation: 52313
For historical reasons, the default color format for a SurfaceView is RGB_565, which can lead to funky-looking greys (not to mention banding).
You can use the SurfaceHolder#setFormat() call to change the color format to RGB_888 or RGBA_8888.
Upvotes: 3