首页 > 代码库 > 熟悉AndroidAPI系列13——LayoutInflater

熟悉AndroidAPI系列13——LayoutInflater

如何把一个xml文件渲染成一个View控件

1         //如何把一个xml文件渲染为一个View控件2         //得到一个对这个Activity的渲染器inflater3         LayoutInflater inflater = this.getLayoutInflater();4         //将image_switch.xml渲染成View控件5         View view = inflater.inflate(R.layout.image_switch, null);6         builder.setView(view);

 

熟悉AndroidAPI系列13——LayoutInflater