android 设置横屏竖屏
来源:互联网 发布:linux 网络接口 编辑:程序博客网 时间:2024/05/20 23:59
在android应用开发过程中,尤其是在界面布局当中,经常会碰到要指定布局为横屏或是竖屏显示,下面是一些设置android横竖屏的方法:
- 代码控制
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//设置成全屏模式
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);//强制为横屏
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//竖屏
- xml控制
在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.
- android 画面横屏竖屏设置
- android:screenOrientation横屏竖屏设置
- Android横屏竖屏设置
- Android横屏竖屏设置
- android 设置横屏竖屏
- android 设置横屏竖屏
- Android 设置横屏竖屏
- cocos2dx android横屏竖屏设置
- Android之设置横屏竖屏
- Android横屏竖屏设置
- android横屏竖屏设置
- Android之设置横屏竖屏
- Android 设置横屏竖屏
- android设置横屏竖屏
- Android之设置横屏竖屏
- android:screenOrientation属性(设置横屏竖屏)
- Android 模拟器横屏竖屏切换设置
- Androidの界面设置横屏竖屏
- 循环删除vector和map中的元素
- 一个比较完善的C++ Singleton模式类
- C++中wstring与string相互转化
- LSI RAID配置手册(图文)
- cocos2d-x 内存释放的机制和使用要注意的地方
- android 设置横屏竖屏
- Cocos2d-x学习(十九):iOS6中无法正常游戏横屏的解决方案
- Cocos2d-x学习(十七):Cocos2d-x建工程时避免copy文件夹和库
- Cocos2d-x学习(十八):Tiled妙用
- Cocos2d-x学习(二十):cocos2d中的容器CCArray
- Cocos2d-x学习(二十一):cocos2d-x引擎结构
- NDT .so
- Cocos2d-x学习(二十二):cocos2d-x中CCScale9Sprite的另一种实现
- 纯js实现瀑布流(自动适应窗口大小)