VideoView-全屏播放

来源:互联网 发布:linux man命令 下一页 编辑:程序博客网 时间:2024/05/13 23:25

布局文件:

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical">    <VideoView        android:id="@+id/vv_video"        android:layout_width="match_parent"        android:layout_height="match_parent"      android:layout_centerInParent="true"/></RelativeLayout>
全屏代码:

vv_video为VideoView

RelativeLayout.LayoutParams layoutParams=new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,        LayoutParams.MATCH_PARENT);layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);vv_video.setLayoutParams(layoutParams);

0 0
原创粉丝点击