Android How to create a View Programmatically

后端 未结 2 1606
广开言路
广开言路 2021-01-05 11:02

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

2条回答
  •  一个人的身影
    2021-01-05 11:52

    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.

提交回复
热议问题