通常我们的应用只会设计成横屏或者竖屏,锁定横屏或竖屏的方法是在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竖屏 根据重力 上下翻转。 如果有兴趣,你也可以试试其他的值哦...
转载请注明出处:如何让Android屏幕只能上下翻转 http://blog.csdn.net/oracleot/article/details/19045011

更多相关文章

  1. Android日记之2012/02/16——浅谈Android重力感应
  2. 浅谈Android重力感应
  3. 微软的 Android 计划:邪恶的天才计划或只是邪恶?
  4. 【Android 笔记 五】 Android Sensor感应器介绍(一)重力感应加速度
  5. android 重力感应初步认识
  6. Catalog Service - 解析微软微服务架构实例代码
  7. 介绍一个微软开源项目网站--CodePlex
  8. 具体分析微软的xml解析器
  9. 继 GitHub 后微软又收购了 npm

随机推荐

  1. 用asp.net mvc部分视图渲染html的实例教
  2. 关于C#如何实现Access以时间段查询出来的
  3. WPF实现定时刷新UI界面的实例详解
  4. ASP.NET Core中新功能--环境变量和启动设
  5. 基于Calendar实现blog日历的实例详解
  6. 创建自己的RSS实例教程
  7. MVC5下拉框单选绑定的具体代码实现
  8. Asp.net 中用GridView控件的实例教程
  9. C#中如何使用SendMessage?
  10. .NET Core 2.0 Preview2的详细介绍