温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Android 屏幕实现上下翻转

发布时间:2020-08-23 12:17:38 来源:脚本之家 阅读:235 作者:oracleot 栏目:移动开发

Android 屏幕实现上下翻转

通常我们的应用只会设计成横屏或者竖屏,锁定横屏或竖屏的方法是在manifest.xml文件中设定属性android:screenOrientation为"landscape"或"portrait":

 <activity
      android:name="com.example.kata1.MainActivity"
      android:label="@string/app_name" 
      android:screenOrientation="landscape">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>

其实screenOrientation还可以设置成很多值:

android:screenOrientation    =     ["unspecified" | "behind" |
                   "landscape" | "portrait" |
                   "reverseLandscape" | "reversePortrait" |
                   "sensorLandscape" | "sensorPortrait" |
                   "userLandscape" | "userPortrait" |
                   "sensor" | "fullSensor" | "nosensor" |
                   "user" | "fullUser" | "locked"]

其中sensorLandscape就是横屏根据重力上下翻转,sensorPortrait竖屏根据重力上下翻转。

如果有兴趣,你也可以试试其他的值哦...

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI