首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

施用inflater实现窗体布局

2012-07-18 
使用inflater实现窗体布局/* 传统的方式 */// setContentView(R.layout.main)/* inflater方式 */LayoutIn

使用inflater实现窗体布局

/* 传统的方式 */  // setContentView(R.layout.main);    /* inflater方式 */  LayoutInflater inflater = LayoutInflater.from(Inflate.this);// 生成inflater对象  LinearLayout mainFrame = (LinearLayout) inflater.inflate(R.layout.main,null);// 找到窗体的布局文件  LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);  this.addContentView(mainFrame, params);

?

LayoutInflaterinflater=LayoutInflater.from(this);    LayoutInflaterinflater=getLayoutInflater();   LayoutInflaterinflater=(LayoutInflater)this.getSystemService(LAYOUT_INFLATER_SERVICE);

?

热点排行