【发布时间】:2015-06-10 21:35:13
【问题描述】:
我正在尝试将线性布局或相对布局内的视频视图拉伸到全屏,但应用程序不会将视频视图的宽度拉伸到与 android 屏幕相同的宽度。 左右两边总是有 10 到 15 dp 的空间。线性布局和相对布局也没有拉伸到全屏。我希望它以宽度填充屏幕。我也尝试用“match_parent”代替“fill_parent”,但结果是一样的。 这是我的代码
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res /android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bgsong"
android:orientation="vertical"
>
<VideoView
android:id="@+id/video_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
video_player_view = (VideoView) findViewById(R.id.video_view);
dm = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(dm);
int height = dm.heightPixels;
int width = dm.widthPixels;
video_player_view.setMinimumWidth(width);
video_player_view.setMinimumHeight(height);
Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video);
video_player_view.setVideoURI(uri);
video_player_view.start();
【问题讨论】:
标签: android android-layout android-activity android-videoview