Inflate layout programmatically within another layout

前端 未结 8 2064
心在旅途
心在旅途 2020-11-30 04:54

I need help with my android app. I need inflate a layout within another layout and I dont know how I do. My xml code is this:

  • item.xml - I need inflate mult

8条回答
  •  星月不相逢
    2020-11-30 05:12

    Kotlin code to do so:

     val layoutToInflate = 
     this.layoutInflater.inflate(R.layout.ly_custom_layout, 
      null)
    container_destacado.addView(layoutToInflate )
    

提交回复
热议问题