码迷,mamicode.com
首页 > 移动开发 > 详细

Android实例-Delphi在运行时更改Android屏幕旋转(IOS也支持,但还没有写,下午我回来加上。不过我可没有苹果机,测试不了)

时间:2020-04-08 09:42:13      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:variant   tchar   object   utils   android   www   begin   ports   logs   

相关资料:

https://www.it1352.com/624177.html

 

 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, FMXTee.Engine,
 8   FMXTee.Procs, FMXTee.Chart, FMX.Layouts, FMX.Controls.Presentation,
 9   FMX.StdCtrls;
10 
11 type
12   TForm2 = class(TForm)
13     Layout1: TLayout;
14     Chart1: TChart;
15     Layout2: TLayout;
16     Button1: TButton;
17     Button2: TButton;
18     Button3: TButton;
19     Button4: TButton;
20     procedure Button1Click(Sender: TObject);
21   private
22     { Private declarations }
23   public
24     { Public declarations }
25   end;
26 
27 var
28   Form2: TForm2;
29 
30 implementation
31 uses
32   FMX.Platform; //需要引入
33 {$R *.fmx}
34 {$R *.LgXhdpiPh.fmx ANDROID}
35 
36 procedure TForm2.Button1Click(Sender: TObject);
37 var
38   ScreenService: IFMXScreenService;
39   OrientSet: TScreenOrientations;
40 begin
41   if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenService))
42   then
43   begin
44     OrientSet := [TScreenOrientation.soLandscape];
45     ScreenService.SetScreenOrientation(OrientSet);
46   end;
47 end;
48 
49 end.

 

Android实例-Delphi在运行时更改Android屏幕旋转(IOS也支持,但还没有写,下午我回来加上。不过我可没有苹果机,测试不了)

标签:variant   tchar   object   utils   android   www   begin   ports   logs   

原文地址:https://www.cnblogs.com/FKdelphi/p/12657760.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!