我正在尝试向linearlayout添加两个listview,但只显示第一个listview,有人知道为什么吗?
private void populateListView(ConstraintLayout root, List<Product> products){
....
ConstraintLayout.LayoutParams newParams = new ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT);
...
ListView listView = (ListView)getLayoutInflater().inflate(R.layout.list_view_product, null);
listView.setId(View.generateViewId());
listView.setLayoutParams(newParams);
...
ListView listView2 = (ListView)getLayoutInflater().inflate(R.layout.list_view_product, null);
listView2.setId(View.generateViewId());
listView2.setLayoutParams(newParams);
...
LinearLayout linearLayoutView = (LinearLayout)root.findViewById(R.id.fragment_ll_home);
linearLayoutView.addView(listView2,0);
linearLayoutView.addView(listView,1);
}
暂无答案!
目前还没有任何答案,快来回答吧!