动态添加布局文件就是在当前文件中添加其他布局文件,主要是要使用其他布局文件中的控件,主要使用的类是LayoutInflater类,在创建的过程中,先要添加服务后,直接的使用inflate()方法。
LayoutInflaterinflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.residemenu, this);
动态添加布局文件就是在当前文件中添加其他布局文件,主要是要使用其他布局文件中的控件,主要使用的类是LayoutInflater类,在创建的过程中,先要添加服务后,直接的使用inflate()方法。
LayoutInflaterinflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.residemenu, this);