2 qq 29948451 qq_29948451 于 2016.03.02 15:18 提问

Android问题,求大神指导视频怎么按横屏全屏进行缩放~~~~~~~~~~!

如题~~~~~~~~~~~~~~~~~~~~~~~~!!!!!!!

1个回答

crazy1235
crazy1235   Ds   Rxr 2016.03.03 22:23

自定义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);
    }

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!