Samsung Galaxy Tab portrait orientation problems
I making an app and im currently optimizing it to Samsung Galaxy Tab. I have a little problem here, when i launch the application, it is came up in only one portrait orientation.
I use this code:
android:screenOrientation="portrait"
It is only working with one portrait screen orientation, so if i rotate the device to upside down, its now changing. Its a little annoying, because if i start the application in the wrong orientation, my app came up in upside down and wont change.
What can i do with this ?
You can try Activity. setRequestedOrientation(int)
The parameter can be either ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
or ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
Instead of setting android:screenOrientation="portrait"
, you should set android:screenOrientation="sensorPortrait"
if you are on API Level 9+.
For more info: check documentation.
在onCreate()调用super.onCreate()之前调用方法...它应该工作...
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
链接地址: http://www.djcxy.com/p/41838.html
上一篇: 如何在android中获取设备的方向?
下一篇: 三星Galaxy Tab纵向定位问题