[英]Get Auto-Rotate Information On Android
I am working on an app for Android, for which I would like to know whether or not Auto-Rotate is enabled. 我正在开发Android应用程序,我想知道是否启用了自动旋转。 Does anybody know how I can get this?
有谁知道我怎么能得到这个? So just for clarity: I only need to know whether or not a user has Auto-Rotate enabled in their settings or not.
所以为了清楚起见:我只需要知道用户是否在其设置中启用了自动旋转功能。
You can Get Auto-Rotate Information On/Off Using Settings.System.ACCELEROMETER_ROTATION
as : 您可以使用
Settings.System.ACCELEROMETER_ROTATION
打开/关闭自动旋转信息:
if (android.provider.Settings.System.getInt(getContentResolver(),Settings.System.ACCELEROMETER_ROTATION, 0) == 1){
Toast.makeText(Rotation.this, "Rotation ON", Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(Rotation.this, "Rotation OFF", Toast.LENGTH_SHORT).show();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.