结果:

1.

实例代码:

 unit Unit1;

 interface

 uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Sensors,
FMX.StdCtrls, FMX.Controls.Presentation, System.Sensors.Components; type
TForm1 = class(TForm)
MotionSensor1: TMotionSensor;
Switch1: TSwitch;
Label1: TLabel;
Timer1: TTimer;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
procedure Switch1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.fmx}
{$R *.NmXhdpiPh.fmx ANDROID} procedure TForm1.FormCreate(Sender: TObject);
begin
Timer1.Enabled := False;
end; procedure TForm1.Switch1Click(Sender: TObject);
begin
MotionSensor1.Active := Switch1.IsChecked;
Timer1.Enabled := Switch1.IsChecked;
end; procedure TForm1.Timer1Timer(Sender: TObject);
var
LProp: TCustomMotionSensor.TProperty;//所有可能得到的参数
begin
for LProp in MotionSensor1.Sensor.AvailableProperties do//开始循环,如果手机支持该参数则显示出来
begin
case LProp of
TCustomMotionSensor.TProperty.AccelerationX:
begin
Label10.Visible := True;
Label10.Text := Format('Acceleration X: %6.2f', [MotionSensor1.Sensor.AccelerationX]);
end;
TCustomMotionSensor.TProperty.AccelerationY:
begin
Label11.Visible := True;
Label11.Text := Format('Acceleration Y: %6.2f', [MotionSensor1.Sensor.AccelerationY]);
end;
TCustomMotionSensor.TProperty.AccelerationZ:
begin
Label12.Visible := True;
Label12.Text := Format('Acceleration Z: %6.2f', [MotionSensor1.Sensor.AccelerationZ]);
end;
TCustomMotionSensor.TProperty.AngleAccelX:
begin
Label13.Visible := True;
Label13.Text := Format('Angle X: %6.2f', [MotionSensor1.Sensor.AngleAccelX]);
end;
TCustomMotionSensor.TProperty.AngleAccelY:
begin
Label14.Visible := True;
Label14.Text := Format('Angle Y: %6.2f', [MotionSensor1.Sensor.AngleAccelY]);
end;
TCustomMotionSensor.TProperty.AngleAccelZ:
begin
Label15.Visible := True;
Label15.Text := Format('Angle Z: %6.2f', [MotionSensor1.Sensor.AngleAccelZ]);
end;
TCustomMotionSensor.TProperty.Motion:
begin
Label16.Visible := True;
Label16.Text := Format('Motion: %6.2f', [MotionSensor1.Sensor.Motion]);
end;
TCustomMotionSensor.TProperty.Speed:
begin
Label17.Visible := True;
Label17.Text := Format('Speed: %6.2f', [MotionSensor1.Sensor.Speed]);
end;
end;
end;
end; end.

Android实例-MotionSensor加速度(XE8+小米2)的更多相关文章

  1. Android实例-操作摄像头(XE8+小米2)

    结果: 1.同样是照相,自己的程序设置为高质量时刷新慢,而小米手机的相机那真心反映快呀. 2.就算我设置为最高质量,可相片也没有小米手机的相片大.我最大是2000*1000,而小米可以做到3000*2 ...

  2. Android实例-手机震动(XE8+小米2)

    相关资料:http://blog.csdn.net/laorenshen/article/details/41148843 结果: 1.打开Vibrate权限为True. 2.规律震动我没感觉出来,有 ...

  3. Android实例-LocationSensor位置传感器(XE8+小米2)

    结果: 1.启动后有时会闪退,后来重新做的工程就好了.原因不明(可能与地理反码有关). 2.原文是用的GOOGLE地图显示位置,但在咱们这里好像不行,改为百度,但百度用的是HTML文件.太麻烦了,大家 ...

  4. Android实例-消息框(XE8+小米2)

    方法一支持. 方法二与方法三都是三方单元,功能相同. 方法4与方法5报错,提示平台不支持. 第三方单元一: unit Android.JNI.Toast; // Java bridge class i ...

  5. Android实例-实现扫描二维码并生成二维码(XE8+小米5)

    相关资料: 第三方资料太大没法写在博文上,请下载CSDN的程序包. 程序包下载: http://download.csdn.net/detail/zhujianqiangqq/9657186 注意事项 ...

  6. Android实例-调用GOOGLE的TTS实现文字转语音(XE7+小米2)(无图)

    注意:在手机上必须选安装文字转语音引擎“google Text To Speech”地址:http://www.shouji56.com/soft/GoogleWenZiZhuanYuYinYinQi ...

  7. Android实例-调用GOOGLE的TTS实现文字转语音(XE7+小米2)(XE10.1+小米5)

    相关资料: 注意:在手机上必须选安装文字转语音引擎“google Text To Speech”地址:http://www.shouji56.com/soft/GoogleWenZiZhuanYuYi ...

  8. 45个android实例源码

    分享45个android实例源码,很好很强大http://www.apkbus.com/android-20978-1-1.html andriod闹钟源代码http://www.apkbus.com ...

  9. 分享45个android实例源码,很好很强大

    分享45个android实例源码,很好很强大 http://www.apkbus.com/android-20978-1-1.html 分享45个android实例源码,很好很强大http://www ...

随机推荐

  1. Codeforces Round #243 (Div. 2) A~C

    题目链接 A. Sereja and Mugs time limit per test:1 secondmemory limit per test:256 megabytesinput:standar ...

  2. POJ3297+map字符串处理

    简单的字符串处理题. 要注意细节! 附数据两组: ABCC abc ae AAA abc AAAA abc A a B a C a /* */ #include<stdio.h> #inc ...

  3. mvc+entity framework database first,生成的model每次更新一个表会更新所有的model

    在使用Entity Framework 的Database frist或model first时,直接加attribute到modle类上是太现实也不合理的,因为model类是自动生成的,重新生成后会 ...

  4. JavaScript代码调试

    怎么在浏览器中调试JavaScript代码呢?首先,你需要安装Google Chrome浏览器,Chrome浏览器对开发者非常友好,可以让你方便地调试JavaScript代码.安装后,随便打开一个网页 ...

  5. 深入研究Java类加载机制

    类加载是Java程序运行的第一步,研究类的加载有助于了解JVM执行过程,并指导开发者采取更有效的措施配合程序执行. 研究类加载机制的第二个目的是让程序能动态的控制类加载,比如热部署等,提高程序的灵活性 ...

  6. SQL Server R2 2008中的SQL Server Management Studio 阻止保存要求重新创建表的更改问题的设置方法

    在2008中会加入阻止保存要求重新创建表的更改这个选项.症状表现为修改表结构的时候会"阻止"你. SQL Server 2008“阻止保存要求重新创建表的更改”的错误的解决方案是本 ...

  7. DB2系统管理试题标准答案

    1. 如果需要创建一个表,并把表中的索引数据和其他数据分开存储,则应该 A.建立两个SMS表空间分别存储索引数据和其他数据 B.建立两个DMS表空间分别存储索引数据和其他数据 C.建立一个DMS表空间 ...

  8. 配置oschina for pc 开发环境

    oschina for pc 是一款用python + pyqt + html + css +js开发的桌面程序,感觉十分强大.python开发快捷, 网页技术绚丽,正是桌面程序需要的. 感谢铂金小鸟 ...

  9. (转载)关于gcd的8题

    发现其实有关gcd的题目还是挺多的,这里根据做题顺序写出8题. [bzoj2818: Gcd] gcd(x,y)=质数, 1<=x,y<=n的对数 做这题的时候,懂得了一个非常重要的转化: ...

  10. c#字符串及数组操作

    字符串操作(取当前时间)string time=convert.tostring(DateTime.Today).split( new char []{' '});    textbox1.text= ...