From 1cfe022f05ee0b70d3ec998a5bd7d9713ef56cf7 Mon Sep 17 00:00:00 2001 From: droidwolf Date: Fri, 17 Jan 2014 14:14:03 +0800 Subject: [PATCH] adapter getview position always return 0 when the adapter getView convertView parameter has been created,the position parameter always return 0. because in onMeasure function viewflow call obtainView pass 0(line 167),it need to pass mCurrentAdapterIndex. --- viewflow/src/org/taptwo/android/widget/ViewFlow.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/viewflow/src/org/taptwo/android/widget/ViewFlow.java b/viewflow/src/org/taptwo/android/widget/ViewFlow.java index e36590c..436c827 100644 --- a/viewflow/src/org/taptwo/android/widget/ViewFlow.java +++ b/viewflow/src/org/taptwo/android/widget/ViewFlow.java @@ -164,7 +164,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int count = mAdapter == null ? 0 : mAdapter.getCount(); if (count > 0) { - final View child = obtainView(0); + //final View child = obtainView(0); + final View child = obtainView(mCurrentAdapterIndex); measureChild(child, widthMeasureSpec, heightMeasureSpec); childWidth = child.getMeasuredWidth(); childHeight = child.getMeasuredHeight();