How to add a button control to an android xml view at runtime?

前端 未结 6 535
陌清茗
陌清茗 2020-12-11 16:26

I have an android xml layout, main.xml. I would like to add controls to this layout at runtime (I would like to add a series of additional linear layouts that contain button

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-11 17:22

    You can add controls programmatically if you want in your code, or even another XML with a View and an Inflater.

    Here you can read the basics: http://developer.android.com/guide/topics/ui/declaring-layout.html

提交回复
热议问题