如题~~~~~~~~~~~~~~~~~~~~~~~~!!!!!!!
1条回答
关注 自定义VideoView
private int mVideoWidth = 0; private int mVideoHeight = 0; public CustomVideoView(Context context) { super(context); // TODO Auto-generated constructor stub } public CustomVideoView(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } public CustomVideoView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // TODO Auto-generated constructor stub } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // TODO Auto-generated method stub // Log.i("@@@@", "onMeasure"); //下面的代码是让视频的播放的长宽是根据你设置的参数来决定 int width = getDefaultSize(mVideoWidth, widthMeasureSpec); int height = getDefaultSize(mVideoHeight, heightMeasureSpec); setMeasuredDimension(width, height); }
解决 无用评论 打赏 举报