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

  • 相关阅读:
    rbd-mirror新功能
    ceph查询rbd的使用容量(快速)
    Ceph Bluestore首测
    让磁盘硬盘灯常闪定位盘
    aa
    地理围栏
    Can't connect to MySQL server on localhost (10061)解决方法
    经典智力题
    MEF程序设计指南
    ESRI.ArcGIS.AnalysisTools.Erase 结果是空?
  • 原文地址:https://www.cnblogs.com/laijinquan/p/5947832.html
Copyright © 2011-2022 走看看