2013-03-26 108 views
0

所有人。我想要videoview全屏显示视频,我试过使用一些命令,但他们没有解决。我需要一些帮助。我把我的代码放在下面。全屏显示不显示视频

视频继续显示约1/3的屏幕!我是新手!

Intro.JAVA

  public class Intro extends Activity { 
    public void onCreate(Bundle b) { 
    super.onCreate(b); 
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); 
     requestWindowFeature(Window.FEATURE_NO_TITLE); 
     setContentView(R.layout.intro); 

     VideoView vid = (VideoView) findViewById(R.id.videoView1); 
     String uriPath = "android.resource://com.english/raw/videoenglish"; 
     Uri uri = Uri.parse(uriPath); 
     vid.setVideoURI(uri); 
     vid.start(); 
     vid.requestFocus(); 

     vid.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { 

     public void onCompletion(MediaPlayer mp) { 
      // TODO Auto-generated method stub 
       Intent main = new Intent(Intro.this, IntentsDemoActivity.class); 
        Intro.this.startActivity(main); 
        Intro.this.finish(); 
      } 

      }); 
     } 
     } 

INTRO.XML

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout 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/videoView1" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentTop="true" 
    android:layout_gravity="center" /> 

</LinearLayout> 
+0

也许这是视频的分辨率? – Kgrover 2013-03-26 17:00:40

回答

0

通常情况下,实际的视频不会填满屏幕了很多时间,因为视频的宽高比不匹配屏幕本身的宽高比。

我怀疑VideoView本身正在填满整个屏幕。尝试使用其他设备或模拟器。

下面是一些供参考的其他问题两种方式: