标签:
代销机构,一个scrollview中嵌套了三个自定义的gridview,但是问题来了,发现高度不可控,其实仔细观察就会发现,最后一行显示不完全,是因为item定义的问题,设置的宽高合适,就能放得下每个item,就不会出现item超越边界的问题。另附上另外一种写法,直接用普通的gridview,然后高度自己去算:
/*//自己获取高度 public void setListViewHeightBasedOnChildren(GridView gridView) { if (adapterOne == null) { return; } int totalHeight = 0; for (int i = 0; i < ((bankList.size()/3)+1); i++) { View listItem = adapterOne.getView(i, null, gridView); listItem.measure(0, 0); totalHeight += listItem.getMeasuredHeight(); } BaseUtil.Log(totalHeight + "@@"); ViewGroup.LayoutParams params = gridView.getLayoutParams(); params.height = totalHeight ; ((ViewGroup.MarginLayoutParams)params).setMargins(15, 15, 15, 15); gridView.setLayoutParams(params); }*/
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/qqyanjiang/article/details/47337973