349_inflate和Inflator

来源:互联网 发布:自动打印软件 编辑:程序博客网 时间:2024/06/15 08:00




inflate和Inflator




之前一直习惯用View.inflate
现在发现这样用应该是不恰当的
View view=View.inflate(context,R.layout.item,null);
这样的话item最外层会失效


View view = LayoutInflater.from(context).inflate(R.layout.item, parent, false);


这样的话最外层才有效


所以item里面可以直接给高度比如50dp







0 0
原创粉丝点击