gpt4 book ai didi

android - 在 Android 上获取自动旋转信息

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:31:06 25 4
gpt4 key购买 nike

我正在为 Android 开发一个应用程序,我想知道是否启用了自动旋转。有人知道我怎么能得到这个吗?所以为了清楚起见:我只需要知道用户是否在他们的设置中启用了自动旋转。

最佳答案

您可以使用 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();
}

关于android - 在 Android 上获取自动旋转信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12867236/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com