我在setcontent了一个布局文件,里面有个RelativeLayout的ID为ToboundContent。
现在想把另一个ID为Content的布局文件塞进ToboundContent里。
这个应该很简单的吧。求解答。希望回答的清楚点,我是小白。
------解决方案--------------------
mView = (RelativeLayout) findViewById(R.id.ToboundContent);
mView.addView(view);
view另一个布局文件。
------解决方案--------------------
LayoutInflater mInflater = LayoutInflater.from(context);
view = mInflater.inflate(R.layout.global_menu_layout, null);
------解决方案--------------------
综合楼上的做法,就可以实现了。
LayoutInflater mInflater = LayoutInflater.from(context);
view = mInflater.inflate(R.layout.global_menu_layout, null);
先把你的view实例化,然后调用ViewGroup的addView(),就可以了。