码迷,mamicode.com
首页 > 移动开发 > 详细

Android开发之获取布局填充器

时间:2015-07-17 18:56:53      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:开发   android   layoutinflater   layout   布局   

Android开发之获取布局填充器的三种方式

第一种 :

LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.item_listview, null); // 第一个参数写你需要加载的布局文件

第二种 :

LayoutInflater inflater = LayoutInflater.from(MainActivity.this); // 参数 : 填写context
View view = inflater.inflate(R.layout.item_listview, null);       // 第一个参数写你需要加载的布局文件

第三种 :

View view = View.inflate(MainActivity.this, R.layout.item_listview, null);

版权声明:本文为博主原创文章,未经博主允许不得转载。

Android开发之获取布局填充器

标签:开发   android   layoutinflater   layout   布局   

原文地址:http://blog.csdn.net/weiwosuoai/article/details/46929599

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!