diff --git a/Library/src/com/slidinglayer/SlidingLayer.java b/Library/src/com/slidinglayer/SlidingLayer.java index 5867aa8..3b4b0a0 100644 --- a/Library/src/com/slidinglayer/SlidingLayer.java +++ b/Library/src/com/slidinglayer/SlidingLayer.java @@ -1082,7 +1082,20 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); // Make sure scroll position is set correctly. - if (w != oldw) { + boolean fix; + switch (mScreenSide) { + case STICK_TO_LEFT: + case STICK_TO_RIGHT: + fix = w != oldw; + break; + case STICK_TO_TOP: + case STICK_TO_BOTTOM: + fix = h != oldh; + break; + default: + fix = (w != oldw) || (h != oldh); + } + if (fix) { completeScroll(); int[] pos = getDestScrollPos(); scrollTo(pos[0], pos[1]);