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);
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);
}