I need to create a view programmatically. The controls(buttons, labels, etc.) and their positions are known only at runtime.
Here I found \"Defining a Layout Program
I would take a look at the Lunar lander example in the android API samples here http://developer.android.com/resources/samples/LunarLander/index.html. This helped me out tremendously when starting out making games and having to dynamically draw to the screen.
Create a custom ViewGroup; this allows you to manage placements of each of the children you have (buttons, labels, etc) manually. Check this vid from the google IO event in 2009 titled 'Make your Android UI Fast and Efficient', specifically from about 43 minutes onward for more details.