scrollview?
listview的高度是一定的話,可以重寫一個listview在onmesure方法里設定固定高度,如下代碼:
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(MeasureSpec.UNSPECIFIED, 0) );
int childHeight = getMeasuredHeight() - (getListPaddingTop() + getListPaddingBottom() + getVerticalFadingEdgeLength() * 2);
int fullHeight = getListPaddingTop() + getListPaddingBottom() + childHeight*(getCount());
setMeasuredDimension(getMeasuredWidth(), fullHeight)