Introduction
Note, the solution provided in the link below did not help me solve my problem:
How to detect when an Android app goes to the background and come back to the foreground
Hallo Stack Overflow Community
I am trying to create simple Android app that allows a user to select text and upper or lower case it, along with a function to remove extra spaces. My app has only three objects, namely two of TButton
and one of TMemo
. I have encountered a problem with the TMemo
and the virtual keyboard. Whenever the virtual keyboard pops up, it displays over the bottom of the TMemo
. I have managed to solve this problem by working with the OnVirtualKeyboardHidden
and OnVirtualKeybaordShown
event handlers of the TForm
. Here’s how I did it:
procedure TfrmEditor.FormVirtualKeyboardHidden(Sender: TObject;
KeyboardVisible: Boolean; const Bounds: TRect);
begin
memInput.Align := memInput.Align.alClient;
end;
procedure TfrmEditor.FormVirtualKeyboardShown(Sender: TObject;
KeyboardVisible: Boolean; const Bounds: TRect);
begin
if memInput.Align <> memInput.Align.alTop then
begin
memInput.Align := memInput.Align.alTop;
memInput.Height := memInput.Height - Bounds.Height;
end;
end;
Problem
So here’s my problem: whenever the virtual keyboard is shown and I switch to another app and switch back, the virtual keyboard is hidden but the TMemo
TAlignLayout
ins’t restored back to alClient
.
If anyone can help me with this TMemo
and virtual keyboard problem I would really appreciate it.
Thank you in advance!