I have MySurfaceView that extends SurfaceView. I draw a rectangle as background in MySurfaceView.
Paint p = new Paint();
p.setColor(0xfff3f3f3);
canvas.drawRect(0f, 0f, bgWidth, bgHeight, p);
fff3f3f3 is background_holo_light. I want the background color of MySurfaceView to be equal to the background color of my other UI components.
However, the background color of MySurfaceView is actually fff7f3f7 in Nexus 5. :(
How would I know this? I make a screenshot through DDMS, open GIMP, pick up color.
Then I try a few other values. Both go up and down.
UP:
p.setColor(0xfff3f3f3);
turns out to be f7f3f7. :(
p.setColor(0xfff4f4f4);
turns out to be f7f7f7. :(
p.setColor(0xfff6f6f6);
turns out to be f7f7f7. :(
p.setColor(0xfff7f7f7);
turns out to be f7f7f7.
DOWN:
p.setColor(0xfff0f0f0);
turns out to be f7f3f7. :(
p.setColor(0xffefefef);
turns out to be efefef.
Any ideas why?? I just simply want the color of background_holo_light or f3f3f3.
Edit 1 - problem related to screenshot?
My other UI component, e.g. RelativeLayout, have the attribute "android:background" to be background_holo_light (f3f3f3). These UI components show the correct color (f3f3f3) in the screenshot of Nexus 5. By the way, the screenshots are captured by DDMS, in PNG format.
In other words, I feel that the way Android draw RelativeLayout is different from the way Android draw rectangle in SurfaceView.