Android的视频查看全屏 [英] Android-Video View in Fullscreen

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

问题描述

我试图让这个VideoView出现在全屏模式下:

I am trying to make this VideoView to appear in full screen mode :

public class ViewVideo extends Activity {
  private String filename;
  private static final int INSERT_ID = Menu.FIRST;

  @Override
  public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        System.gc();
        Intent i = getIntent();
        Bundle extras = i.getExtras();
        filename = extras.getString("videofilename");
        VideoView vv = new VideoView(getApplicationContext());
        setContentView(vv);
        vv.setVideoPath(filename);
        vv.setMediaController(new MediaController(this));
        vv.requestFocus();
        vv.start();
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      super.onCreateOptionsMenu(menu);
      menu.add(0, INSERT_ID, 0,"FullScreen");

      return true;
  }

  @Override
  public boolean onMenuItemSelected(int featureId, MenuItem item) {
      switch(item.getItemId()) {
      case INSERT_ID:
          createNote();
      }
      return true;
  }

  private void createNote() {
        requestWindowFeature(Window.FEATURE_NO_TITLE);  
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,   
                             WindowManager.LayoutParams.FLAG_FULLSCREEN);  
  }
}

该视频是从S​​D卡播放。唯一的一点是,当我点击全屏菜单按钮,应用程序意外停止。

The video is playing from sdcard. Only thing is when I click on the full-screen menu button, the application "stops unexpectedly".

请帮我出,如何让视频全屏运行?先谢谢了。

Please help me out, how to get the video to run in full screen? Thanks in advance.

推荐答案

当你点击一个菜单项。你要开始​​一个新的活动。该活动必须设置在清单中的主题属性。设置这个值是

when you click an menu item. you have to start a New Activity. for that Activity you have to set the theme attribute in the Manifest. set this value that is

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

完蛋了。

这篇关于Android的视频查看全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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