Avoid passing null as the view root (need to resolve layout parameters on the inflated layout's root element)

前端 未结 7 705
旧时难觅i
旧时难觅i 2020-11-27 10:13

Passing null for root studio gives me this warning:

Avoid passing null as the view root (need to resolve layout parameters on the inflated layout\'s r

7条回答
  •  攒了一身酷
    2020-11-27 10:20

    Here ya go, for some reason using View.inflate instead of inflating from a layoutinflater makes the lint error disappear. Thought I'd post this here since this thread is at the top of the Google Search...

    view = View.inflate(context,R.layout.custom_layout,null);
    

提交回复
热议问题