[android]android device display activity是否需要横竖屏完美解决方案
来源:互联网 发布:数据库的二级映像 编辑:程序博客网 时间:2024/06/09 22:39
Put this bool resource in res/values as bools.xml or whatever (file names don't matter here):
<?xml version="1.0" encoding="utf-8"?> <resources> <bool name="portrait_only">true</bool> </resources>
Put this one in res/values-sw600dp and res/values-xlarge:
<?xml version="1.0" encoding="utf-8"?> <resources> <bool name="portrait_only">false</bool> </resources>
Then, in the onCreate method of your Activities you can do this:
if(getResources().getBoolean(R.bool.portrait_only)){ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }
Devices that are more than 600 dp in the smallest width direction, or x-large on pre-Android 3.2 devices (tablets, basically) will behave like normal, based on sensor and user-locked rotation, etc. Everything else (phones, pretty much) will be portrait only.
摘自:http://stackoverflow.com/questions/9627774/android-allow-portrait-and-landscape-for-tablets-but-force-portrait-on-phone
0 0
- [android]android device display activity是否需要横竖屏完美解决方案
- android横竖屏切换,activity生命周期方法是否会回调
- Android Activity横竖屏切换
- Android横竖屏切换解决方案
- Android横竖屏切换解决方案
- Android横竖屏切换解决方案
- Android横竖屏切换解决方案
- Android横竖屏切换解决方案
- Android横竖屏切换解决方案
- android 横竖屏切换,activity的生命周期
- Android 横竖屏切换 Activity生命周期log
- Android横竖屏切换不重启Activity
- Java乔晓松-android activity横竖屏切换
- Android:横竖屏切换,activity变化详解
- android横竖屏切换activity生命周期变化
- Android 横竖屏切换activity生命周期
- Android横竖屏切换Activity生命周期变化
- Android Activity横竖屏切换的生命周期
- 渗透信息收集
- skill
- DM与ML的主要区别
- java经典问题(一)
- 知识分类——情商与智商
- [android]android device display activity是否需要横竖屏完美解决方案
- Hibernate执行save方法报错
- Android 进入Activity中默认不弹出软键盘
- linux下启动ssh服务以便使用putty登录
- ajax从服务器端取到json,直接显示json的元素,却为undefined的问题
- AES工具类
- RWTHLM 源码分析(二)之数据组织
- github之标签操作
- 跪求php语言转java急啊