我正在寻找类似 ImageView.ScaleType 中的 CENTER_CROP 的东西
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"
但对于 VideoView。有这样的东西吗?
最佳答案
您只能通过 TextureView 来实现这一点。 (surfaceView 也不起作用)。这是一个在带有中心裁剪功能的纹理 View 中播放视频的库。不幸的是,TextureView 只能在 api 级别 14 及更高级别中使用。
https://github.com/dmytrodanylyk/android-video-crop
另一种可能是放大视频 View 恰到好处,但我还没有尝试过。
关于android - 居中裁剪 Android VideoView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19601921/