在我的应用程序中,我有一个ListView,ListView中的每个项目都有一个GridLayout。 我通过适配器类向GridLayout添加一个自定义视图。添加到GridLayout的视图的大小不一样。它可能因视图而异。 我在getView()适配器代码,Android:GridLayout的分隔线
for (int i = 0,j=0; i < (data.get(position).getItems().size() * 2) && j< (data.get(position).getItems().size()); i=i+2,j++) {
View childView=getChildView(position, j);
childView.setBackgroundColor(Color.CYAN);
Log.i("ChildView Height",childView.getLayoutParams().height+" length");
holder.order_row.addView(childView, i);
holder.order_row.addView(getItemSeparatorView(minHeight),i+1);
}
private View getChildView(int pos, int i) {
//Log.i("position in child", pos + "");
View child = inflater.inflate(R.layout.order_item, null);
InnerViewHolder inholder = new InnerViewHolder