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.
Android设置横屏竖屏的更多相关文章
- Android 设置 横屏 竖屏 (转)
http://2960629.blog.51cto.com/2950629/701227 方法一:在AndroidManifest.xml中配置 如果不想让软件在横竖屏之间切换,最简单的办法就是在项目 ...
- Android 设置 横屏 竖屏
方法一:在AndroidManifest.xml中配置 如果不想让软件在横竖屏之间切换,最简单的办法就是在项目的AndroidManifest.xml中找到你所指定的activity中加上androi ...
- 【转】Android 模拟器横屏竖屏切换设置
http://blog.csdn.net/zanfeng/article/details/18355305# Android 模拟器横屏竖屏切换设置时间:2012-07-04 来源:设计与开发 ...
- Android之横屏竖屏显示问题
1.採用不同的布局文件 在res下创建目录layout-land 在该目录下写入的layout(xml文件)横屏的时候系统自己主动选择显示的layout 同理: 在res下创建目录layout-por ...
- Android之设置横屏竖屏
方案一:在AndroidManifest.xml中配置 在项目的AndroidManifest.xml中找到你所指定的activity中加上Android:screenOrientation属性,它有 ...
- Android判断横屏竖屏代码
// 判断Android当前的屏幕是横屏还是竖屏.横竖屏判断 if (this.getResources().getConfiguration().orientation == Configurati ...
- Android禁止横屏竖屏切换
在Android中要让一个程序的界面始终保持一个方向,不随手机方向转动而变化的办法: 只要在AndroidManifest.xml里面配置一下就可以了. 在AndroidManifest.xml的ac ...
- cocos2d-x ios 设置横屏/竖屏(全)
Cocos2d-x项目\iOS\RootViewController.mm文件中. 以下方法任选其一即可… 本人机子函数二ok! 函数一: (BOOL)shouldAutorotateToI ...
- Android横屏竖屏切换的问题
Android横屏竖屏切换的问题 http://blog.sina.com.cn/s/blog_77c632410101790w.html
随机推荐
- postman-记录cookies信息
接口:赞我的列表,get请求,要登陆用户信息 http://v80.pcauto.com.cn/xsp/s/auto/info/nocache/club/getPraiseMyDynas.xsp?pa ...
- QIIME1 聚OTU
qiime 本身不提供聚类的算法,它只是对其他聚otu软件的封装 根据聚类软件的算法,分成了3个方向: de novo: pick_de_novo_otus.py ...
- [linux]Error: failure: repodata/repomd.xml from fedora: [Errno 256] No more mirrors to try.
在使用fedora17 系统的yum源的时候出现了例如以下错误: Error: failure: repodata/repomd.xml from fedora: [Errno 256] No mor ...
- GridView如何将分页数据全部导出为EXCEL?
GRIDVIEW分页状态下将全部数据导出 protected void Button2_Click(object sender, EventArgs e)//按button2将gridview将数据导 ...
- 关于Struts2的多文件上传
之前写过一篇文章,关于Struts2文件上传:http://www.cnblogs.com/lichenwei/p/3927964.html 现在来说下多文件上传,其实就把上传文件当成是一个数组去处理 ...
- Backlight当前行背景高亮显示
下载地址:https://github.com/limejelly/Backlight-for-XCode PS:Xcode 8.0 默认支持了 跟VVDocumenter规范注释生成器的安装方式一样 ...
- (第3篇)HDFS是什么?HDFS适合做什么?我们应该怎样操作HDFS系统?
摘要: 这篇文章会详细介绍HDFS是什么,HDFS的作用,适合和不适合的场景,我们该如何操作HDFS? HDFS文件系统 Hadoop 附带了一个名为 HDFS(Hadoop分布式文件系统)的分布 ...
- Android Studio添加so文件并打包到APK的lib文件夹中
Gradle官方在新版本中已经实现了自动打包.so文件功能了. 只需要在build.gradle的文件中的android目录下配置一下即可: sourceSets { main { jniLibs.s ...
- abbyy在使用时提示更改分辨率如何处理
ABBYY FineReader 12识别质量取决于文档图像的分辨率.低图像分辨率(低于 150 dp)可能会降低识别质量,而过高的分辨率(高于 600 dpi)也不会明显提升图像质量,还会延长处理时 ...
- 读取文件中"-1"的问题,要用int类型。
char类型 栈空间,遇到-1结束循环. int类型则遇到-1不会结束循环. 4个字节的int. 每个汉字由两个负数组成. 映射过去后,-68变成了:256-68=188. int类型读过去变成了正数 ...