android - Delphi 和 Android:OrientationSensor 没有倾斜信息
问题描述
在使用 Delphi 10.2 开发的多设备应用程序中,我刚刚创建了一个空表单并放入TOrientationSensor
.
TOrientationSensor
确实有倾斜属性:
OrientationSensor1.Sensor.TiltX
OrientationSensor1.Sensor.TiltY
OrientationSensor1.Sensor.TiltZ
但是当被查询时,他们返回了一个带有 NAN 值的双精度值。
为了了解发生了什么,我放下了一个按钮和一个备忘录,并设法显示了OrientationSensor1.Sensor.AvailableProperties
. 代码如下所示。
我得到的只是:
HeadingX
HeadingY
HEadingZ
所以 TiltX/Y/Z 不可用。怎么会这样?也许我必须在设备级别启用某些东西?
我在 moto g6 plus 上对其进行了测试;安卓版本为 8.0.0。
procedure TForm2.Button1Click(Sender: TObject);
var
properties: TCustomOrientationSensor.TProperties;
prop: TCustomOrientationSensor.TProperty;
begin
OrientationSensor1.Active := true;
properties := OrientationSensor1.Sensor.AvailableProperties;
for prop in properties do begin
Memo1.Lines.Add(TRttiEnumerationType.GetName(prop));
end;
end;
解决方案
推荐阅读
- android - 在android中更新或插入数据库
- amazon-web-services - AWS Cloudfront 失效与 OriginPath
- javafx - JavaFX 动态表单字段 UI
- python - 用于捕获当前帧并杀死过去帧的 Python 代码。
- javascript - 重新加载后使用 jQuery,我的整个网站向左移动,看起来很糟糕
- javascript - 如何在此电子邮件验证正则表达式中添加对 +(加号)的支持?
- scroll - 没有滚动条的 flex 滚动
- linux - 从文件中删除所有附加扩展名
- python - 如何安装python模块
- excel - 检查单元格是否包含除 az 以外的其他字符;0-9