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

 

 

 

 

posted on 2012-03-13 17:54  lock  阅读(273)  评论(0编辑  收藏  举报