zoukankan      html  css  js  c++  java
  • 视频 之自定义VideoView

    package com.lvshandian.partylive.view;

    import android.content.Context;
    import android.util.AttributeSet;
    import android.widget.VideoView;

    /**
    * Created by zhang on 2016/11/24.
    */

    public class FullScreenVideoView extends VideoView {
    private int videoWidth;
    private int videoHeight;

    public FullScreenVideoView(Context context) {
    super(context);
    }

    public FullScreenVideoView(Context context, AttributeSet attrs) {
    super(context, attrs);
    }

    public FullScreenVideoView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int width = getDefaultSize(videoWidth, widthMeasureSpec);
    int height = getDefaultSize(videoHeight, heightMeasureSpec);
    if (videoWidth > 0 && videoHeight > 0) {
    if (videoWidth * height > width * videoHeight) {
    height = width * videoHeight / videoWidth;
    } else if (videoWidth * height < width * videoHeight) {
    width = height * videoWidth / videoHeight;
    }
    }
    setMeasuredDimension(width, height);
    }

    public int getVideoWidth() {
    return videoWidth;
    }

    public void setVideoWidth(int videoWidth) {
    this.videoWidth = videoWidth;
    }

    public int getVideoHeight() {
    return videoHeight;
    }

    public void setVideoHeight(int videoHeight) {
    this.videoHeight = videoHeight;
    }

    }
  • 相关阅读:
    数论练习
    AC自动机*
    矩阵乘法*
    概率期望*
    组合数学练习*
    图论升级*
    【终端使用】"su"命令切换用户
    【终端使用】"which"命令可以查看执行命令所在的位置
    【终端使用】"usermod"命令 和 组(包括:主组、附加组)
    Ubuntu 18.04安装 MySQL 8.0+版本的数据库
  • 原文地址:https://www.cnblogs.com/huihuizhang/p/6099230.html
Copyright © 2011-2022 走看看