tags:

views:

21

answers:

1

Hi,

I've got a standard RelativeLayout laying out my Buttons and TextAreas. What I want to do now is be able to draw various sparks, flying cows etc. at arbitrary places on the screen on top of the whole thing. What's the best way to do this? Should I override onDraw() on the containing View and draw after calling super.onDraw()? Or is there some better way of drawing a layer on top?

+1  A: 

You'll probably want to put your Relative layout and a custom view which isn't focusable and doesn't consume motionevents inside a FrameLayout, then override OnDraw in that custom view. That way you can call invalidate() on that view without making Android redraw everything else.

QRohlf
Brilliant, this works perfectly. I hadn't found FrameLayout so I was starting to implement my own ViewGroup to do the same job. I didn't need to explicitly ignore events - they seem to fall through to the buttons behind.
Nick