java - Android: Draw Rectangle Over Another Rectangle on Canvas -


i'm trying draw 1 rectangle that's light gray on rectangle that's white on canvas, doesn't seem anything. here's i've got:

public void ondraw(canvas c) {     paint paint = new paint();     paint.setcolor(color.ltgray);     c.drawrect(0, 0, width, height, paint);     paint.setcolor(color.white);     c.drawrect(10, 10, width - 10, height - 10, paint); //this smaller gray rectangle, looks kinda border. } 

to display this, use setcontentview() in main activity set view new class extending surfaceview. when surface created in custom surfaceview, starts thread executes ondraw() every 100 milliseconds. got canvas using holder.lockcanvas(), ondraw()ing , holder.unlockcanvasandpost(c).

where initializing width , height? set 0? try calling canvas.getwidth() or canvas.getheight().


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -