Change orientation at runtime

冷暖自知 提交于 2019-11-27 03:21:19

问题


I'm new to android my question is, Is it possible to change orientation programmatically? If yes, how can we do that?


回答1:


setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

Also add this in your manifest file (under activity):

android:configChanges = "orientation"



回答2:


Yes, use setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); to force orientation




回答3:


yes this one possible

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);



来源:https://stackoverflow.com/questions/9837184/change-orientation-at-runtime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!