您的位置:首页 > 其它

使用LayoutInflater获取XML配置的Layout

2010-12-19 14:16 441 查看
可以使用LayoutInflater来获取Layout的xml配置。

1、LayoutInflater有2中方式获得:

<1>、LayoutInflater flater= getLayoutInflater();

<2>、LayoutInflater flater= (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);

2、获取Layout:

//R.layout.customer是Layout的xml配置

View layout = flater.inflate(R.layout.customer,null);

3、获取Layout中的组件:

ImageView image = (ImageView) layout.findViewById(R.id.imgview);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: