Android OrientationEventListener SensorManager.SENSOR_DELAY_NORMAL 必要性 [英] Android OrientationEventListener SensorManager.SENSOR_DELAY_NORMAL Necessity

查看:114
本文介绍了Android OrientationEventListener SensorManager.SENSOR_DELAY_NORMAL 必要性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自文档,它说:

使用默认值 SENSOR_DELAY_NORMAL 进行简单的屏幕方向变化检测.

Use the default value of SENSOR_DELAY_NORMAL for simple screen orientation change detection.

这是否意味着如果我在构造函数中不包含传感器速率,它仍然会应用SENSOR_DELAY_NORMAL?

Does it mean that if I don't include the sensor rate in the constructor, it will still apply the SENSOR_DELAY_NORMAL?

换句话说,这两个是否相同:

In other words, are this two the same:

OrientationEventListener(context)

OrientationEventListener(context, Sensor.SENSOR_DELAY_NORMAL)

PS:我用于简单的屏幕方向变化检测.

推荐答案

根据 官方源码,前者的构造函数定义如下,

According to the official source code, the former constructor is defined as follows,

/**
 * Creates a new OrientationEventListener.
 * 
 * @param context for the OrientationEventListener.
 */
public OrientationEventListener(Context context) {
    this(context, SensorManager.SENSOR_DELAY_NORMAL);
}

所以,完全等同于后者.你可以随意使用.

So, it's completely equivalent to the latter. You can use whichever you like.

这篇关于Android OrientationEventListener SensorManager.SENSOR_DELAY_NORMAL 必要性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆