Firemonkey表单缩放到所有移动设备

时间:2014-02-25 09:15:42

标签: delphi mobile scale device

我正在使用Delphi XE5开发一个Android应用程序,但我在扩展我的设计时遇到问题,无法修复2.8英寸和10.1英寸移动设备范围内的所有移动设备。

指出我对此的任何回答问题将不胜感激,或者一个例子将是最有帮助的。

1 个答案:

答案 0 :(得分:1)

我通常使用alScale Align属性。这是一个例子:

Small Big

FMX:

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 426
  ClientWidth = 429
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [dkDesktop]
  DesignerMobile = True
  DesignerWidth = 429
  DesignerHeight = 426
  DesignerDeviceName = ''
  DesignerOrientation = 3
  DesignerOSVersion = ''
  object Layout1: TLayout
    Align = alScale
    Height = 426.000000000000000000
    Width = 139.604690551757800000
  end
  object Layout2: TLayout
    Align = alScale
    Height = 426.000000000000000000
    Position.X = 139.236679077148400000
    Width = 155.230239868164100000
  end
  object Layout3: TLayout
    Align = alScale
    Height = 426.000000000000000000
    Position.X = 293.525726318359400000
    Width = 139.236633300781300000
    object Button1: TButton
      Align = alScale
      Height = 26.625030517578130000
      Position.X = 43.169849395751950000
      Position.Y = 358.227325439453100000
      TabOrder = 0
      Text = 'Button1'
      Width = 71.949905395507810000
    end
  end
end

PAS:

unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
  FMX.Layouts;

type
  TForm1 = class(TForm)
    Layout1: TLayout;
    Layout2: TLayout;
    Layout3: TLayout;
    Button1: TButton;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

end.