- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我想知道android设备是否支持设备旋转。我以为任何 Android 设备都支持屏幕旋转,但我的 Samsung Galaxy View 不支持任何旋转。
我只找到这段代码:
if (android.provider.Settings.System.getInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 1){
Toast.makeText(getApplicationContext(), "Auto Rotate is ON", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "Auto Rotate is OFF", Toast.LENGTH_SHORT).show();
}
但这只会让我知道用户是否将屏幕旋转设置为关闭或打开,我想知道这是否完全可行。
请帮帮我,最良好的祝愿
狮子座
最佳答案
您可以检查传感器 的可用性。这是官方docs
PackageManager manager = getPackageManager();
boolean hasAccelerometer = manager.hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER);
加速度计的作用
The accelerometer is a built-in electronic component that measures tilt and motion. It is also capable of detecting rotation and motion gestures such as swinging or shaking.
The most common use for it is to activate auto screen rotation on mobile devices when the user changes their orientation from portrait to landscape or vice-versa.
关于android - 检查android设备旋转是否可行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43092700/
对于我的一个项目,我终于需要使用我的第一个多态类(std::cout 除外)。 我正在研究如何确保至少在某些情况下我有 100% 的去虚拟化调用。 这段代码是否合法可行? dynamic_cast 有
最近有一个编译问题,用这个片段说明: struct Base { }; template struct A : Base { A(){} A(Base&&) {} }; A foo()
注意:这是一个冗长的问题,需要对 MVVM“设计模式”、JSON 和 jQuery 有很好的理解.... 所以我有一个理论/主张 DHTML 中的 MVVM 是可能的 和可行的 并且想知道您是否同意/
我有一台 Mac 服务器,我正在构建 PHP 代码以允许用户上传图像、文档甚至视频文件。研究这个肯定让我很紧张,我希望上传的内容没有病毒。 自己构建一些东西会是一个巨大的挑战吗?您会这样做,还是会
根据文档,ASP.NET 项目(尚)不支持新的 PackageReference https://learn.microsoft.com/en-us/nuget/consume-packages/pa
我是一名优秀的程序员,十分优秀!