add layout as a view in Android

前端 未结 3 1451
清歌不尽
清歌不尽 2021-02-20 02:44

I have a pretty complex layout defined in xml file , now I want to add this layout as a view using addView or something else.

As layout is pret

3条回答
  •  执笔经年
    2021-02-20 03:12

    If your view is a ViewGroup (layout) You can use InflaterService.inflate(id, ViewGroup) and set the ViewGroup, it will set the current child(s) with the content of your xml.

提交回复
热议问题