android- LayoutInflater
第一步:得到当前Activity的LayoutInflater object.
//下面俩种方法都可以
//LayoutInflater inflater = getLayoutInflater();
LayoutInflater inflater = (LayoutInflater)this.getSystemService(LAYOUT_INFLATER_SERVICE);
第二步:通过inflate方法得到View
View layout = inflater.inflate(R.layout.custom_dialog,null);// R.layout.custom_dialog -> View的资源ID