I have a page with a 'button' (actually a TapGestureRecognizer on a StackLayout). When pressed I add or remove some things from another StackLayout in the page.
The problem is that on Android after pressing sometimes you still see parts of the previous screen like duplicate buttons (1 in old location and 1 in new location). This goes away when you touch the screen and scroll it a little bit. But I want to do this refresh from code.
What I tried:
- ForceLayout() or InvalidateMeasure() on the page after my changes
- ForceLayout() on the ScrollView after my changes
- Putting the layout changes in a Device.BeginInvokeOnMainThread
I 'solved' it by scrolling from code after my changes: await scrollview.ScrollToAsync(scrollview.ScrollX, scrollview.ScrollY - 1, false);
Does anyone have a better solution? Or is it a bug in Forms that its makers should solve?