Android – Center Crop an Android VideoView

androidandroid-videoviewcentercropscale

I am looking for something like the CENTER_CROP in ImageView.ScaleType

Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding). The image is then centered in the view. From XML, use this syntax: android:scaleType="centerCrop"

but for a VideoView. Does anything like this exist?

Best Answer

You can only achieve this with a TextureView. (surfaceView won't work either). Here's a lib for playing video in a textureView with center crop function. TextureView can only be used in api level 14 and up unfortunately.

https://github.com/dmytrodanylyk/android-video-crop

Another possibility is to zoom in the videoview just right, but I haven't tried that yet.