可以使用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);