VideoView的视频的全屏播放

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.Window;
import android.widget.MediaController;
import android.widget.RelativeLayout;
import android.widget.VideoView;

public class QuanPingActivity extends Activity {

private VideoView video_quanping;
    private String shipinUrl="http://101.200.142.201:8080/VideoPlay/video";

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
        setContentView(R.layout.activity_quan_ping);
        //获得传来的值
        Intent intent=getIntent();
        String videourl=intent.getStringExtra("videourl");
        //找到VideoView控件
        video_quanping = (VideoView) findViewById(R.id.video_quanping);
        
        //视频的播放        媒体控制器
                MediaController mediaController=new MediaController(this);
                video_quanping.setMediaController(mediaController);//设置一个控制条  
                Uri uri=Uri.parse(shipinUrl+videourl);
                //设置视频的URL
                video_quanping.setVideoURI(uri);
                //请求焦点
                video_quanping.requestFocus();
                //开始播放
                video_quanping.start();
                
                
                
                //String path = getIntent().getStringExtra("path");
               // mVideoView02.setVideoURI(Uri.parse(path));
                //相对布局         的布局参数
                RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
                        //设置为填充父窗体
                        RelativeLayout.LayoutParams.FILL_PARENT,
                        RelativeLayout.LayoutParams.FILL_PARENT);
                //添加管理
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
                //设置布局
                video_quanping.setLayoutParams(layoutParams);
                video_quanping.start();

}

//----------xml布局文件-----------------------

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
     >
     <VideoView android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:id="@+id/video_quanping"/>

</RelativeLayout>

上一篇:WCF 服务应用程序与 服务库之间的区别


下一篇:PHP错误:Forbidden You don't have permission to access / on this server.