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

Android实例-闪光灯的控制(XE8+小米2)

时间:2015-08-20 18:28:02      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

 

 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.Media,
 8   FMX.Controls.Presentation, FMX.StdCtrls;
 9 
10 type
11   TForm1 = class(TForm)
12     CameraComponent1: TCameraComponent;//闪光灯的控制控件
13     Button1: TButton;
14     procedure FormCreate(Sender: TObject);
15     procedure Button1Click(Sender: TObject);
16   private
17     { Private declarations }
18   public
19     { Public declarations }
20   end;
21 
22 var
23   Form1: TForm1;
24 
25 implementation
26 
27 {$R *.fmx}
28 {$R *.NmXhdpiPh.fmx ANDROID}
29 
30 procedure TForm1.Button1Click(Sender: TObject);
31 begin
32   if Button1.Text =  then
33   begin
34     CameraComponent1.TorchMode := TTorchMode.tmModeOn;//开灯
35     Button1.Text := ;
36   end
37   else
38   begin
39     CameraComponent1.TorchMode := TTorchMode.tmModeOff;//关灯
40     Button1.Text := ;
41   end;
42 end;
43 
44 procedure TForm1.FormCreate(Sender: TObject);
45 begin
46   Button1.Enabled := CameraComponent1.HasFlash;//如果没有闪光灯,则按钮不起作用
47   CameraComponent1.Active := True;
48 end;
49 
50 end.

 

Android实例-闪光灯的控制(XE8+小米2)

标签:

原文地址:http://www.cnblogs.com/FKdelphi/p/4745831.html

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