views:

17

answers:

0

Hi everyone

I'm totally new to android programming (just did some tutorials/read the dev guides etc.) and as every newbie I want to do a useless game :-).

Currently I'm struggling with the layout of different views. Similar to the example I've made a class which extends a SurfaceView and put that into a FrameLayout. Around this SurfaceView I want to have other View's like Buttons & TextViews. Something like this:

-----------------------------------------------
| TextView | SurfaceView           | TextView |
|          |                       |          |
------------                       ------------
|          |                       | TextView |
|          |                       |          |
|          |                       ------------
|          |                       | TextView |
|          |                       |          |
|          |                       ------------
|          |                       |          |
|          |                       |          |
-----------------------------------------------
| Button                             Button   |
-----------------------------------------------

I've managed to do something like this with a FrameLayout and RelativeLayouts (sticking the TextViews at the edges of the screen) but I'd like to better control the size of the SurfaceView as it should be a multiple in width and height of the object(s) I'll be drawing in it. I've tried setting "layout_width" and "layout_height" to some dp values but when i start painting at 0,0 it's still at the very top-left corner (where the TextView is..).

So, what's the best practice to achieve a layout as above? Using what layout? Or should i better draw my text inside the draw() function of my SurfaceView instead??

Any help is very welcome! :-)

thx!