天天看點

listview和scrollview嵌套資料顯示不全問題解決!

public class HeightFixListView extends ListView {

    public HeightFixListView(Context context) {
        super(context);
    }

    public HeightFixListView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public HeightFixListView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int height = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
                MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, height);
    }   //重寫listview高度
}      

繼續閱讀