Delphi Firemonkey,在横向模式Android上显示矩形
当TEdit将焦点设置为纵向模式时,如何在横向位置显示包含TEdit的矩形?我使用这样的代码,但在横向位置,当Tedit将焦点设置为纵向时,Tedit被键盘覆盖Delphi Firemonkey,在横向模式Android上显示矩形,delphi,orientation,firemonkey,landscape,Delphi,Orientation,Firemonkey,Landscape,当TEdit将焦点设置为纵向模式时,如何在横向位置显示包含TEdit的矩形?我使用这样的代码,但在横向位置,当Tedit将焦点设置为纵向时,Tedit被键盘覆盖 procedure TForm1.RestorePosition; begin VertScrollBox1.ViewportPosition := PointF(VertScrollBox1.ViewportPosition.X, 0); Layout1.Align := TAlignLayout.Client; Vert
procedure TForm1.RestorePosition; begin VertScrollBox1.ViewportPosition := PointF(VertScrollBox1.ViewportPosition.X, 0); Layout1.Align := TAlignLayout.Client; VertScrollBox1.RealignContent; end;
procedure TForm1.UpdateKBBounds; var LFocused : TControl; LFocusRect: TRectF; begin FNeedOffset := False; if Assigned(Focused) then begin
LFocused := TControl(Focused.GetObject);
LFocusRect := LFocused.AbsoluteRect;
LFocusRect.Offset(VertScrollBox1.ViewportPosition);
if (LFocusRect.IntersectsWith(TRectF.Create(FKBBounds))) and
(LFocusRect.Bottom > FKBBounds.Top) then
begin
FNeedOffset := True;
Layout1.Align := TAlignLayout.Horizontal;
VertScrollBox1.RealignContent;
Application.ProcessMessages;
VertScrollBox1.ViewportPosition :=
PointF(VertScrollBox1.ViewportPosition.X,
LFocusRect.Bottom - FKBBounds.Top);
end; end; if not FNeedOffset then
RestorePosition; end;
procedure TForm1.FormFocusChanged(Sender: TObject); begin UpdateKBBounds; end;
procedure TForm1.FormVirtualKeyboardHidden(Sender: TObject; KeyboardVisible: Boolean; const Bounds: TRect); begin FKBBounds.Create(0, 0, 0, 0); FNeedOffset := False; RestorePosition; end;
procedure TForm1.FormVirtualKeyboardShown(Sender: TObject; KeyboardVisible: Boolean; const Bounds: TRect); begin FKBBounds := TRectF.Create(Bounds); FKBBounds.TopLeft := ScreenToClient(FKBBounds.TopLeft); FKBBounds.BottomRight := ScreenToClient(FKBBounds.BottomRight); UpdateKBBounds; end;
procedure TForm1.CalcContentBoundsProc(Sender: TObject;
var ContentBounds: TRectF); begin if FNeedOffset and (FKBBounds.Top > 0) then begin
ContentBounds.Bottom := Max(ContentBounds.Bottom,
2 * ClientHeight - FKBBounds.Top); end; end;
procedure TForm1.Edit1Click(Sender: TObject); begin focus := 'edit1'; end;
procedure TForm1.FormCreate(Sender: TObject); begin if TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardToolbarService, IInterface(FService1)) then begin
FService1.SetToolbarEnabled(True);
FService1.SetHideKeyboardButtonVisibility(True); end; VertScrollBox1.OnCalcContentBounds := CalcContentBoundsProc; end;
当tEdit在potrait模式下设置焦点时,我想显示包含横向位置的tEdit的矩形。非常感谢您是否使用android/ios?我不知道你想做什么,但也许你可以试试。在Android上,当您选择一个Tedit并进入横向时,编辑将填满所有可用空间(见演示)谢谢您,先生,您能帮助我在zeus web上找到源代码ALFmxControls.apk吗?我下载zip时,文件太大了。您是否检查了程序文件中的示例项目(x86)\Embarcadero\Studio\18.0\Samples\Object Pascal\Multi-Device Samples\User Interface\ScrollableForm?是的,先生。但在这个例子中,embarcadero关闭了旋转函数。所以我们不知道当edit1聚焦时,横向模式是什么样子。