Hi I have a VideoView in my app, provided the layout width and height as fill parent. But still my video is displayed only in half the portion of the videoView. So I tried providing the width and height in dip. But still the video displays in the same manner. Can anyone help me with t开发者_Python百科his?
I had the same problem. I solved it by creating an own VideoView class extending VideoView, then pass in the width and height from
new VideoPlayer(this, getWindowManager().getDefaultDisplay().getWidth(), getWindowManager().getDefaultDisplay().getHeight());
And this is the VideoPlayer class
public class VideoPlayer extends VideoView {
private int width;
private int height;
public VideoPlayer(Context context, int width, int height) {
    super(context);
    this.width = width;
    this.height = height;
}
public VideoPlayer(Context context, AttributeSet attrs) {
    super(context, attrs);
}
@Override
protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)
{
     setMeasuredDimension(width, height);
}
}
I then added the VideoPlayer view by code to the layout using ViewGroup.addView(VideoPlayer)
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论