@@ -0,0 +1,1385 @@
+/*%0A * The MIT License (MIT)%0A * Copyright (c) 2014 longkai%0A * The software shall be used for good, not evil.%0A */%0Apackage org.catnut.support;%0A%0Aimport android.content.Context;%0Aimport android.util.AttributeSet;%0Aimport android.view.View;%0Aimport android.widget.ListView;%0A%0A/**%0A * a list view that can compute the current scroll Y.%0A */%0Apublic class QuickReturnListView extends ListView %7B%0A%09private int itemCount;%0A%09private int%5B%5D itemsOffsetY;%0A%09private int scrollRange;%0A%09private boolean isScrollRangeComputed;%0A%0A%09public QuickReturnListView(Context context, AttributeSet attrs) %7B%0A%09%09super(context, attrs);%0A%09%7D%0A%0A%09public int getScrollRange() %7B%0A%09%09return scrollRange;%0A%09%7D%0A%0A%09public boolean isScrollRangeComputed() %7B%0A%09%09return isScrollRangeComputed;%0A%09%7D%0A%0A%09public void computeScrollRange() %7B%0A%09%09scrollRange = 0;%0A%09%09itemCount = getAdapter().getCount();%0A%09%09if (itemsOffsetY == null) %7B%0A%09%09%09itemsOffsetY = new int%5BitemCount%5D;%0A%09%09%7D%0A%09%09for (int i = 0; i %3C itemCount; i++) %7B%0A%09%09%09View view = getAdapter().getView(i, null, this);%0A%09%09%09view.measure(%0A%09%09%09%09%09MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),%0A%09%09%09%09%09MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)%0A%09%09%09);%0A%09%09%09itemsOffsetY%5Bi%5D = scrollRange;%0A%09%09%09scrollRange += view.getMeasuredHeight();%0A%09%09%7D%0A%09%09isScrollRangeComputed = true;%0A%09%7D%0A%0A%09public int getComputedScrollY() %7B%0A%09%09int pos = getFirstVisiblePosition();%0A%09%09return itemsOffsetY%5Bpos%5D - getChildAt(0).getTop();%0A%09%7D%0A%7D%0A

add a quick return list view.