视频的看法是不是在横向模式全屏幕 [英] Video view is not full screen in landscape mode

查看:104
本文介绍了视频的看法是不是在横向模式全屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是视频观看设计的XML。这部影片是全屏幕在人像模式,但是,当它变成了风景模式,它是左对齐和宽度和高度都包裹而不是全屏幕。

I am using a video view designed with xml. This video is full screen in Portrait mode but when it turns to the landscape mode, it is left aligned and both width and height are wrapped instead of full screen.

我提到这些,但还是为这个无解。

I referred these, but still no solution for this.

全屏VideoView不集中

Android的视频查看在全屏

任何人知道这个答案吗?

Any one knows the answer for this?

更新:这是我的XML

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">


<VideoView android:id="@+id/youtubewebView"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:layout_alignParentLeft="true" android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentBottom="true" android:layout_gravity="fill" />

</RelativeLayout>

更新2:

public class VideoStreamingActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    final VideoView videoView = (VideoView)findViewById(R.id.your_video_view);
    String videoUrl = "http://www.pocketjourney.com/downloads/pj/video/famous.3gp";
    try {
    Uri uri = Uri.parse(videoUrl);
    videoView.setVideoURI(uri);
    videoView.setMediaController(new MediaController(this));
    videoView.requestFocus();
    //videoView.start();
    videoView.setOnErrorListener(new OnErrorListener() {

        @Override
        public boolean onError(MediaPlayer arg0, int arg1, int arg2) {
            Toast.makeText(getApplicationContext(), "error", Toast.LENGTH_SHORT).show();
            return true;
        }
    });

    }catch (Exception e) {
        e.printStackTrace();
    }

    videoView.setOnPreparedListener(new OnPreparedListener() {

        public void onPrepared(MediaPlayer mp) {
            videoView.start();
        }
    });

}

@Override
protected void onPause() {
    Toast.makeText(getApplicationContext(), "pause", Toast.LENGTH_SHORT).show();
    super.onPause();
}

@Override
protected void onRestart() {
    Toast.makeText(getApplicationContext(), "restart", Toast.LENGTH_SHORT).show();
    super.onRestart();
}

@Override
protected void onResume() {
    Toast.makeText(getApplicationContext(), "resume", Toast.LENGTH_SHORT).show();
    super.onResume();
}

}

推荐答案

您确定它是不是填满屏幕。它为我工作正常。这里是xml文件,

Are you sure that it is not filling up the screen. it works fine for me. Here is the xml file,

的main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <VideoView android:id="@+id/video"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
       android:layout_alignParentRight="true"
       android:layout_alignParentBottom="true"
       android:layout_alignParentTop="true"
        />
</RelativeLayout>

的onCreate()

VideoView video=null;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    video=(VideoView)findViewById(R.id.video);
    video.setVideoURI(Uri.parse("http://www.pocketjourney.com/downloads/pj/video/famous.3gp"));
    video.start();
}

截图人像模式

截图为风景模式

这篇关于视频的看法是不是在横向模式全屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆