inflater的简单使用

private LinearLayout activity_view = null;

// 获得一个可扩展的layout实例
private LayoutInflater inflater = null;

activity_view = (LinearLayout) findViewById(R.id.activity_view);

inflater = (LayoutInflater) MainActivity.this
.getSystemService(LAYOUT_INFLATER_SERVICE);

 

// 将layout添加到view
View view = inflater.inflate(mLayout, null);
activity_view.addView(view);

posted @ 2012-04-13 17:17  幻星宇  阅读(226)  评论(0编辑  收藏  举报