@@ -0,0 +1,1974 @@
+/*%0A * Copyright 2013 Lars Werkman%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.fss.common.ui;%0A%0Aimport android.content.Context;%0Aimport android.util.AttributeSet;%0Aimport android.view.View;%0Aimport android.widget.ListView;%0A%0Apublic class QuickReturnListView extends ListView %7B%0A%0A%09private int mItemCount;%0A%09private int mItemOffsetY%5B%5D;%0A%09private boolean scrollIsComputed = false;%0A%09private int mHeight;%0A%0A%09public QuickReturnListView(Context context) %7B%0A%09%09super(context);%0A%09%7D%0A%0A%09public QuickReturnListView(Context context, AttributeSet attrs) %7B%0A%09%09super(context, attrs);%0A%09%7D%0A%0A%09public int getListHeight() %7B%0A%09%09return mHeight;%0A%09%7D%0A%0A%09public void computeScrollY() %7B%0A%09%09mHeight = 0;%0A%09%09mItemCount = getAdapter().getCount();%0A%09%09if (mItemOffsetY == null) %7B%0A%09%09%09mItemOffsetY = new int%5BmItemCount%5D;%0A%09%09%7D%0A%09%09for (int i = 0; i %3C mItemCount; ++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%09mItemOffsetY%5Bi%5D = mHeight;%0A%09%09%09mHeight += view.getMeasuredHeight();%0A%09%09%09System.out.println(mHeight);%0A%09%09%7D%0A%09%09scrollIsComputed = true;%0A%09%7D%0A%0A%09public boolean scrollYIsComputed() %7B%0A%09%09return scrollIsComputed;%0A%09%7D%0A%0A%09public int getComputedScrollY() %7B%0A%09%09int pos, nScrollY, nItemY;%0A%09%09View view = null;%0A%09%09pos = getFirstVisiblePosition();%0A%09%09view = getChildAt(0);%0A%09%09nItemY = view.getTop();%0A%09%09nScrollY = mItemOffsetY%5Bpos%5D - nItemY;%0A%09%09return nScrollY;%0A%09%7D%0A%7D

add quick return list view