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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM