因为适配器的getView的返回对象是view,
所以线性布局的对象可以通过addView动态加载适配器的getView
举例:
mTestAdapter = new ListAdapter(this); mTestAdapter.addList(wbTest.getTestList()); mLlTestLayout.removeAllViews(); mLlTestLayout.addView(mTestAdapter.getView(0, null, null)); if (wbTest.getTestList().size() > 1) { mLlTestLayout.addView(mTestAdapter.getView(1, null, null)); }