如何让Android屏幕只能上下翻转
16lz
2021-01-23
通常我们的应用只会设计成横屏或者竖屏,锁定横屏或竖屏的方法是在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还可以设置成很多值:
其中 sensorLandscape就是 横屏 根据重力上下翻转, sensorPortrait竖屏 根据重力 上下翻转。 如果有兴趣,你也可以试试其他的值哦...
转载请注明出处:如何让Android屏幕只能上下翻转 http://blog.csdn.net/oracleot/article/details/19045011
<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
更多相关文章
- Android日记之2012/02/16——浅谈Android重力感应
- 浅谈Android重力感应
- 微软的 Android 计划:邪恶的天才计划或只是邪恶?
- 【Android 笔记 五】 Android Sensor感应器介绍(一)重力感应加速度
- android 重力感应初步认识
- Catalog Service - 解析微软微服务架构实例代码
- 介绍一个微软开源项目网站--CodePlex
- 具体分析微软的xml解析器
- 继 GitHub 后微软又收购了 npm