How to scale video on SurfaceView more than on Android?

Android 2.2 (on a media player) with a display of 1280x720.

My video has a height of 480 pixels, a width of 720 pixels; standard definition.

I know that if you change the layouts of SurfaceView, the video is scaled to fit the one that is least suitable for maintaining proportions.

This is great, unless I can only scale to the height of the screen. This is a problem because black bars appear on the top and bottom of the video. Take a look here: http://i.imgur.com/dsiLw.jpg

I will need to make my SurfaceView (and window) larger than the screen.

I know about FLAG_LAYOUT_NO_LIMITS, on WindowManager: http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_LAYOUT_NO_LIMITS

My window is supposed to expand due to the screen ... but I can't get this to work. It seems to resize to 1280x720 pixels no matter what I do.

If you could help me get this so that I can expand my video so that it looks in full screen (cropping the video at the top of the screen), I will be very grateful.

:)

+4
source share

Source: https://habr.com/ru/post/1390333/


All Articles