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控件就可以了。

  • 相关阅读:
    学习的原动力
    “六顶思考帽”给我的启示
    关于DataSet与Strongly typed DataSet几点思考(原创)
    设计模式之Singleton和Factory
    CentOS修改网络配置
    Proxmox VE(PVE)安装教程
    CentOS开启SELinux导致samba无法访问的解决办法
    nano编辑器使用教程
    CentOS 如何挂载硬盘
    PVE硬盘直通
  • 原文地址:https://www.cnblogs.com/laijinquan/p/5947832.html
Copyright © 2011-2022 走看看