无法在全屏模式下播放Android VideoView



在我的项目中,我将宽度和高度的线性布局作为full_parent,并且我正在添加宽度和高度的VideoView作为fill_parent,但视频并未占据整个屏幕。

在XML中尝试将VideoView定义为

<?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/videoView1" android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_alignParentBottom="true"></VideoView>
</RelativeLayout>

把这段代码放在SetContentView之前

requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

我想它可能对你有帮助。

最新更新