1.ScrollView+listView配合着用
2.动态根据listView中item的高度计算listView的高度:
public void setHeight(){
int listViewHeight = 0;
int adaptCount = comAdapter.getCount();
for(int i=0;i<adaptCount;i++){
View temp = comAdapter.getView(i,null,lsComment);
temp.measure(0,0);
listViewHeight += temp.getMeasuredHeight();
}
LayoutParams layoutParams = this.lsComment.getLayoutParams();
layoutParams.width = LayoutParams.FILL_PARENT;
layoutParams.height = listViewHeight;
lsComment.setLayoutParams(layoutParams);
}
import android.view.ViewGroup.LayoutParams;
本文介绍了一种在Android应用中结合使用ScrollView和ListView的方法,并提供了动态调整ListView高度以适应ScrollView的技术实现细节。
639

被折叠的 条评论
为什么被折叠?



