views:

843

answers:

3

I am creating a android app using LunarLander as a example. Now I need to create a few buttons which are drawn over the view. I do not want them as a seperate layout above or below the view but in the custom view. Is this possible or am I going to have to programmatically show the button images then detect the touch. The buttons I create using new never show on the app. I assume this is because I have overwritten the onDraw and the buttons are never drawn even though I call super.onDraw(canvas);

A: 

Hi
I think you could use FrameLayout to show two layers - first would be your surface from lunar, and second is the layout with buttons etc. You could define everything in layout.xml file. Probably that is enough.
Regards!

Ramps
A: 

Hi!

If your view extends Linear/Relative/TableLayout, you can use view.bringChildToFront(child).

Ungureanu Liviu
A: 

Use AbsoluteLayout & then in your ui thread set button.bringTioFront() & you are done! watch this post http://stackoverflow.com/questions/4022998/problem-when-using-more-elements-in-the-listview/4023535#4023535

100rabh