VideoView ViewPager black lines while swiping

久未见 提交于 2020-01-16 03:48:05

问题


I have a problem with VideoView and ViewPager swiping action. While swiping I can see black lines on the right or left side of VideoView (depends on side of swiping) . How can I deal with this.

It was done using FragmentStatePagerAdapter and ViewPager. Parent Activity has SurfaceView with 0px width and height and set getWindow( ).setFormat( PixelFormat.TRANSLUCENT ); I'm adding VideoView from JAVA code.


回答1:


VideoView is based of Surfaceview which is not very ideal for translation and other behaviours. and much more suited to full screen video players that are static in layout. What you are looking for is textureview based videoview. Try searching library on github.




回答2:


you could try setting the background of the videoview to transparent.

videoView.setBackgroundResource(android.R.color.transparent);


来源:https://stackoverflow.com/questions/38032570/videoview-viewpager-black-lines-while-swiping

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