13
A
回答
37
您可以通过编程去两个如下:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
或也清单文件,你可以给这里
<activity android:name=".YourActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation"/>
8
这在您的清单文件添加到您的活动代码:
android:screenOrientation="landscape"
这将解决您的方向为横向模式,你需要不显示任何祝酒用户。
2
在你的manifest资源配置文件(XML)
<activity android:name=".ActivityName" android:screenOrientation="landscape">
</activity>
指这也Is that possible to check was onCreate called because of orientation change?
0
可以使用configChanges
-attribute你想赶上为屏幕方向变化的活动。
之后,活动中的onConfigurationChanged()
-method将在方向更改时调用。
要检查哪个方位当前显示的,请在此较早的帖子:Check orientation on Android phone
之后,你可以炫耀你的消息或做任何你喜欢(当然你也可以将它设置为只在山水秀) 。
0
你可以尝试这样的事情
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
Log.v("log_tag", "display width is "+ width);
Log.v("log_tag", "display height is "+ height);
if(width<height){
Toast.makeText(getApplicationContext(),"Device is in portrait mode",Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(),"Device is in landscape mode",Toast.LENGTH_LONG).show();
}
相关问题
- 1. 如何仅在横向模式下限制j2me应用程序
- 2. 使Android应用程序全屏横向模式下仅
- 3. 在横向和纵向模式下启动iPad应用程序
- 4. 仅在调试模式下运行的Android应用程序
- 5. iPhone应用程序在横向模式下打开iPad上
- 6. iOS 8 - 在横向模式下启动应用程序
- 7. iPhone应用程序 - 在横向模式下显示AVFoundation视频
- 8. 如何在横向模式下制作ipad应用程序
- 9. 应用程序崩溃,在横向模式下
- 10. iOS应用在横向模式下
- 11. iPhone - 仅限横向应用程序
- 12. 如何调整以景观模式时,应用程序在横向模式下
- 13. 在纵向和横向模式下运行espresso androidTest s
- 14. 如何在UWP应用程序中只启用横向模式?
- 15. iOs应用程序开发的纵向和横向模式
- 16. 当在横向模式下启动应用程序时,UIOrientation不起作用
- 17. 仅当在发布模式下运行时,ReactNative应用程序才会崩溃
- 18. 在横向模式锁定应用程序只
- 19. 应用程序在uwsgi线程模式下运行缓慢
- 20. 程序仅在调试模式下正确运行
- 21. 是否可以在横向模式下隐藏SplitView iPad应用程序的RootViewController?
- 22. 在1.9模式下使用Jruby运行rails应用程序?
- 23. MPMoviePlayerViewController仅在横向模式下播放电影
- 24. 仅在横向模式下显示容器视图
- 25. 隐藏Android的标题栏,仅在横向模式下
- 26. iPad应用程序并不适用于横向模式
- 27. 为整个应用程序禁用横向模式
- 28. 印刷在IE11在横向模式下
- 29. 如何在生产模式下运行react-native应用程序?
- 30. 在同步模式下运行Windows GUI应用程序?
大ans ....... @ android杀手: – pratik