1

每个人。我想 videoview 全屏显示视频,我尝试使用一些命令,但没有成功。我需要一些帮助。我把我的代码放在下面。

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

介绍.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();
            }

          });
         }
        }

介绍.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>
4

1 回答 1

0

通常,实际视频很多时候不会填满屏幕,因为视频的纵横比与屏幕本身的纵横比不匹配。

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

以下是其他一些可供参考的问题:

于 2013-03-26T17:03:34.460 回答