summaryrefslogtreecommitdiff
path: root/core/java/android/widget/ScrollView.java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2010-02-16 12:26:33 -0800
committerAdam Powell <adamp@google.com>2010-02-16 12:26:33 -0800
commita2f91016840bf4f7274577d40f3610e38b77f2ad (patch)
tree2129621f77a987e78eaea6030703bbeb6559f556 /core/java/android/widget/ScrollView.java
parent3d0ff09e35521a97ec1cfe14d57c6868e271fe9a (diff)
Fix for [Horizontal]ScrollView scroll range reporting
Diffstat (limited to 'core/java/android/widget/ScrollView.java')
-rw-r--r--core/java/android/widget/ScrollView.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java
index 2ee7ad5517f9..52ed11d6d069 100644
--- a/core/java/android/widget/ScrollView.java
+++ b/core/java/android/widget/ScrollView.java
@@ -892,14 +892,15 @@ public class ScrollView extends FrameLayout {
*/
@Override
protected int computeVerticalScrollRange() {
- int count = getChildCount();
+ final int count = getChildCount();
+ final int contentHeight = getHeight() - mPaddingBottom - mPaddingTop;
if (count == 0) {
- return getHeight();
+ return contentHeight;
}
int scrollRange = getChildAt(0).getBottom();
- int scrollY = mScrollY;
- int overscrollBottom = scrollRange - getHeight() - mPaddingBottom - mPaddingTop;
+ final int scrollY = mScrollY;
+ final int overscrollBottom = Math.max(0, scrollRange - contentHeight);
if (scrollY < 0) {
scrollRange -= scrollY;
} else if (scrollY > overscrollBottom) {