• Android设置横屏竖屏


    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//设置成全屏模式  
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);//强制为横屏  
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//竖屏  

    在activity里设置android:screenOrientation的值。
    android:screenOrientation的属性有以下值:
    unspecified(默认值,由系统判断状态自动切换),The default value. The system chooses the orientation. The policy it uses, and therefore the choices made in specific contexts, may differ from device to device.
    landscape,横屏
    portrait,竖屏
    user(用户当前设置的orientation值),The user's current preferred orientation.
    behind(下一个要显示的Activity的orientation值),The same orientation as the activity that's immediately beneath it in the activity stack.
    sensor(传感器的方向),The orientation determined by a physical orientation sensor. The orientation of the display depends on how the user is holding the device; it changes when the user rotates the device.
    nosensor(不使用传感器,这个效果差不多等于unspecified).An orientation determined without reference to a physical orientation sensor. The sensor is ignored, so the display will not rotate based on how the user moves the device. Except for this distinction, the system chooses the orientation using the same policy as for the "unspecified" setting.

  • 相关阅读:
    分布式锁
    zookeeper
    工作流笔记第四天_流程变量
    工作流笔记第三天_流程实例
    工作流笔记第二天_流程定义的CRUD
    工作流笔记第一天_简单介绍activiti
    groovy修改代码不用重启通过监听记录改变时间重新加载
    遇到的前端问题
    常用正则表达式大全
    Hibernate中Session.get()方法和load()方法的详细比较
  • 原文地址:https://www.cnblogs.com/newcaoguo/p/6305335.html
Copyright © 2020-2023  润新知