2

我想在固定宽度和高度的对话框中播放视频。我播放了视频,但一些视频内容显示在对话框之外,一些视频内容显示在对话框的右上角。我尝试在运行时设置宽度和高度,但它不起作用。

以下是代码

    Dialog dialog = new Dialog(this,android.R.style.Theme_Translucent_NoTitleBar);
    dialog.setContentView(R.layout.layout_video_popup);

    VideoView mVideoView = (VideoView)dialog.findViewById(R.id.videoView);
    //String path ="http://daily3gp.com/vids/747.3gp";
    mVideoView.setOnPreparedListener(this);
    mVideoView.getHolder().setFixedSize(300, 400);
    dialog.show();
    mVideoView.setVideoPath(path);
    mVideoView.requestFocus();
    mVideoView.start();
4

1 回答 1

0
Window window = dialog.getWindow();
window.setLayout((int) (window.getWindowManager().getDefaultDisplay().getWidth() * .90),
        (int) (window.getWindowManager().getDefaultDisplay().getHeight() * .90));
于 2015-01-01T18:47:14.013 回答