竹山一叶

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

在做一个应用时把Android SDK从4.4换成6.0,使用LayoutInflater的inflate方法时出现以下情

LayoutInflater.inflate(int resource, ViewGroup root)

参数root为null时,出现warning提示

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

建议添加

@SuppressLint("InflateParams")

在网上查了,如果改用View的inflate方法root为null就不会出现warning提示

View.inflate(Context context, int resource, ViewGroup root)





posted on 2017-06-08 16:00  竹山一叶  阅读(2234)  评论(0编辑  收藏  举报