标签:导致 使用 param view for == item adapter ++
ScrollView嵌套listView导致头像错乱
由于listView显示不全,所以是重写的,在网上找了一下,据说是重写的onMeasure导致的头像错乱
So,使用原始的listView并且使用一下方法:
public static void setListViewHeightBasedOnChildren(ListView listView) {
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter == null) {
// pre-condition
return;
}
int totalHeight = 0;
for (int i = 0; i < listAdapter.getCount(); i++) {
View listItem = listAdapter.getView(i, null, listView);
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = listView.getLayoutParams();
params.height = totalHeight
+ (listView.getDividerHeight() * (listAdapter.getCount() - 1));
listView.setLayoutParams(params);
}
标签:导致 使用 param view for == item adapter ++
原文地址:http://www.cnblogs.com/zxbala/p/7380593.html