Android TextView has height and width of 0

后端 未结 4 1327
野性不改
野性不改 2020-12-08 02:33

I have a small project where I want to reuse a certain UI component a few time so I created a widget by expanding a ViewGroup. In that ViewGroup I inflated a view that conta

4条回答
  •  长情又很酷
    2020-12-08 03:20

    Did you try passing yourself as the root:

    View.inflate(context, R.layout.xml, this); 
    

    Since you will be the parent of this View that complies with the javadoc spec.

提交回复
热议问题