zoukankan      html  css  js  c++  java
  • VideoView--简单的设置全屏幕播放

    我说的最主要的是要在布局哪里设置一下,如:

         <com.example.mypalyer.fullScreen
              android:id="@+id/videoView1"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_gravity="center" />

    这里的com.example.mypalyer.fullScreen是我一个继成了VideoView的一个类,具体如下:

    public class fullScreen extends VideoView{

    public fullScreen(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    // TODO Auto-generated constructor stub
    }

    public fullScreen(Context context, AttributeSet attrs) {
    super(context, attrs);
    // TODO Auto-generated constructor stub
    }

    public fullScreen(Context context) {
    super(context);
    // TODO Auto-generated constructor stub
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {//这里重写onMeasure的方法
    // TODO Auto-generated method stub
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    int width = getDefaultSize(0, widthMeasureSpec);//得到默认的大小(0,宽度测量规范)
    int height = getDefaultSize(0, heightMeasureSpec);//得到默认的大小(0,高度度测量规范)
    setMeasuredDimension(width, height); //设置测量尺寸,将高和宽放进去
    }
    }

    然后就没有然后拉,直接用已经设置过的VideoView控件就可以了。

  • 相关阅读:
    Rust 变量
    Rust-lang(hello world 续)
    Rust-lang(hello world)
    Java 1.8 ASM ClassReader failed to parse class file
    Sqoop使用笔记
    Jstorm
    从flume到kafka,日志收集
    vim-3-插件管理
    vim-2-使用进阶
    Git-Repo-Gerrit-1-Git介绍,安装和配置
  • 原文地址:https://www.cnblogs.com/laijinquan/p/5947832.html
Copyright © 2011-2022 走看看