标签:ar java for 数据 div 问题 ad javascript as
首先,scroll中放入listview的话,listview是显示不全的,这时候需要动态修改listview的长度public void setListViewHeight(ListView listView) { // 获取ListView对应的Adapter ListAdapter listAdapter = listView.getAdapter(); if (listAdapter == null) { return; } int totalHeight = 0; for (int i = 0, len = listAdapter.getCount(); i < len; i++) { // listAdapter.getCount()返回数据项的数目 View listItem = listAdapter.getView(i, null, listView); listItem.measure(0, 0); // 计算子项View 的宽高 totalHeight += listItem.getMeasuredHeight(); // 统计所有子项的总高度 } ViewGroup.LayoutParams params = listView.getLayoutParams(); params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1)); listView.setLayoutParams(params); }成功后发现scroll不置顶,这时候只要
myscroll.smoothScrollTo(0,20);就OK了
scroll中放入listview,并解决scroll初始化不置顶问题
标签:ar java for 数据 div 问题 ad javascript as
原文地址:http://blog.csdn.net/u014765620/article/details/40341981