private void KeyboardService_VisibilityChanged(object sender, SoftKeyboardEventArgs e) { int size = ChildCount; var item = GetChildAt(0); item.Measure(0, 0); int height = item.MeasuredHeight; //Reset size of ScrollView SetMinimumHeight(height / size); Invalidate(); }
// KeyboardService code private void KeyboardService_VisibilityChanged(object sender, SoftKeyboardEventArgs e) { // The OnGlobalLayout method is calledd multiple times, so we have to store the previous state // and only do anything if the keyboard visibility is changed if (isKeyboardVisible != e.IsVisible) { isKeyboardVisible = e.IsVisible; // Only has to be set when the keyboard becomes visible, because otherwise // the MainPage_SizeChanged is invoked earlier, so the canSetLayout is already changed if (e.IsVisible) { canSetLayout = false; } } }
public void InvokeVisibilityChanged(SoftKeyboardEventArgs args) { VisibilityChanged?.Invoke(this, args); }