diff --git a/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs index 9b22ea91679..e680f2795df 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs @@ -609,6 +609,7 @@ public TrackElement(int position) AView _trackedView; int _trackedViewPrevPosition; + int _trackedViewPrevHeight; int _trackedViewPrevTop; public void SyncState(AbsListView view) @@ -616,6 +617,7 @@ public void SyncState(AbsListView view) if (view.ChildCount > 0) { _trackedView = GetChild(view); + _trackedViewPrevHeight = view.Height; _trackedViewPrevTop = GetY(); _trackedViewPrevPosition = view.GetPositionForView(_trackedView); } @@ -653,7 +655,7 @@ AView GetChild(AbsListView view) } int GetY() { - return _position <= 1 ? _trackedView.Bottom : _trackedView.Top; + return _position <= 1 ? (_trackedView.Bottom - (_trackedView.Height - _trackedViewPrevHeight)) : _trackedView.Top; } } @@ -710,6 +712,9 @@ public void OnScroll(AbsListView view, int firstVisibleItem, int visibleItemCoun t.SyncState(view); } } + + if (!wasTracked) + _contentOffset = 0; } public void OnScrollStateChanged(AbsListView view, ScrollState scrollState)