Android中获取目标布局文件中的组件

方法如下:

               LayoutInflater flater= LayoutInflater.from(getContext());
                //R.layout.title处填写目标布局
               final View view=flater.inflate(R.layout.title,null);
               //以获取一个EditView为例
               EditText edit=(EditText)view.findViewById(R.id.edit);

 

posted @ 2020-02-12 19:43  溜了溜  阅读(743)  评论(0编辑  收藏  举报