Back to project page AdvancedPlayer.
The source code is released under:
Apache License
If you think the Android project AdvancedPlayer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.huilan.library_videoplay.view; //from www. java2s. c o m import android.content.Context; import android.util.AttributeSet; import android.widget.VideoView; /** * ????VideoView * * @author liujigang */ public class FullScreenVideoView extends VideoView { private int mVideoWidth; private int mVideoHeight; public FullScreenVideoView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public FullScreenVideoView(Context context, AttributeSet attrs) { super(context, attrs); } public FullScreenVideoView(Context context) { super(context); } public int getmVideoWidth() { return getWidth(); } public void setmVideoWidth(int mVideoWidth) { this.mVideoWidth = mVideoWidth; } public int getmVideoHeight() { return getHeight(); } public void setmVideoHeight(int mVideoHeight) { this.mVideoHeight = mVideoHeight; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int width = getDefaultSize(mVideoWidth, widthMeasureSpec); int height = getDefaultSize(mVideoHeight, heightMeasureSpec); if (mVideoHeight * mVideoWidth > 0) { int i = mVideoWidth * height; int j = width * mVideoHeight; if (i < j) { width = i / mVideoHeight; } else if (i > j) { height = j / mVideoWidth; } } setMeasuredDimension(width, height); } }