我正在尝试使用videoview播放视频以覆盖操作栏下方的整个屏幕,它垂直拉伸但水平保持在中间,两侧都有黑色区域..任何人都可以解决问题吗?
public void playVideo(String videoname)
{
VideoView vd = (VideoView) findViewById(R.id.videoView1);
Uri uri = Uri.parse("android.resource://" + getPackageName() + "/raw/" + videoname);
MediaController mc = new MediaController(this);
vd.setMediaController(mc);
vd.setVideoURI(uri);
vd.start();
}
xml文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView
android:id="@+id/videoView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:gravity="center" />
</RelativeLayout>