开发者

surfaceview orientation without main.xml or androidmanifest.xml

开发者 https://www.devze.com 2023-03-27 20:42 出处:网络
I would like to change the orientation of my SurfaceView from landscape to portrait. I\'m doing this without the use of main.xml (rendering it using only java code) and I would like to know how. Most

I would like to change the orientation of my SurfaceView from landscape to portrait. I'm doing this without the use of main.xml (rendering it using only java code) and I would like to know how. Most of the questions here deal with camera orientation, but I would like to know if it's possible to play video in portrait instead of l开发者_开发百科andscape through the SurfaceView. Do I use onMeasure() or onLayout()? Any other functions work? Thanks

BTW I have implemented changes in main.xml and androidmanifest.xml, but they have not worked. I also used setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); but does not work as well.


I found that using

int setOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;

works.

0

精彩评论

暂无评论...
验证码 换一张
取 消