Android实例-多窗口的切换(XE8+小米2)

1.图片一是程序运行后的界面。

2.图片二是点击"非模态显示"的界面。

3.图片三是点击"模诚显示"的界面(提示平台不支持)。

 

 1 unit Unit1;
 2 
 3 interface
 4 
 5 uses
 6   System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
 7   FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
 8   FMX.Controls.Presentation;
 9 
10 type
11   TForm1 = class(TForm)
12     Button1: TButton;
13     Label1: TLabel;
14     Button2: TButton;
15     procedure Button1Click(Sender: TObject);
16     procedure Button2Click(Sender: TObject);
17   private
18     { Private declarations }
19   public
20     { Public declarations }
21   end;
22 
23 var
24   Form1: TForm1;
25 
26 implementation
27 uses Unit2;
28 {$R *.fmx}
29 {$R *.NmXhdpiPh.fmx ANDROID}
30 
31 procedure TForm1.Button1Click(Sender: TObject);
32 begin
33   Form2.Show;//非模态显示窗体二
34 end;
35 
36 procedure TForm1.Button2Click(Sender: TObject);
37 begin
38   Form2.ShowModal;//模态显示窗体二
39 end;
40 
41 end.

 

 1 unit Unit2;
 2 
 3 interface
 4 
 5 uses
 6   System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
 7   FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
 8   FMX.Controls.Presentation;
 9 
10 type
11   TForm2 = class(TForm)
12     Label1: TLabel;
13     Button1: TButton;
14     procedure Button1Click(Sender: TObject);
15   private
16     { Private declarations }
17   public
18     { Public declarations }
19   end;
20 
21 var
22   Form2: TForm2;
23 
24 implementation
25 
26 {$R *.fmx}
27 {$R *.NmXhdpiPh.fmx ANDROID}
28 
29 procedure TForm2.Button1Click(Sender: TObject);
30 begin
31   Form2.Close;//隐藏窗体二
32 {当然,按返回键也能隐藏第二个窗口。
33 总的来说,基本上与 windows 下编程一样。}
34 end;
35 
36 end.

 

posted on 2015-07-29 15:34  疯狂delphi  阅读(1247)  评论(0编辑  收藏  举报

导航