Android VideoView在ScrollView中填充时不展开
此视频视图不会展开并将我的视频放入视图中。如果我设置静态高度和宽度(例如640dp 400dp),视频将成功填充视图并按预期工作 这个问题是在我进入ScrollView设置后出现的——它在自己的父LinearLayout中时工作正常 VideoView的XML:Android VideoView在ScrollView中填充时不展开,android,android-layout,android-videoview,Android,Android Layout,Android Videoview,此视频视图不会展开并将我的视频放入视图中。如果我设置静态高度和宽度(例如640dp 400dp),视频将成功填充视图并按预期工作 这个问题是在我进入ScrollView设置后出现的——它在自己的父LinearLayout中时工作正常 VideoView的XML: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" a
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/gray">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/top_video"
android:layout_alignParentTop="true"
android:orientation="vertical"
android:visibility="gone">
<VideoView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_centerInParent="true"
android:id="@+id/video_view" />
</RelativeLayout>
<!---- many more layouts and views that all get hidden when setting above to visible -->
<!---- many more layouts and views that all get hidden when setting above to visible -->
</LinearLayout>
</ScrollView>
将android:fillViewPort=true添加到滚动视图中,并匹配父级高度
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:fillViewPort=true
android:layout_height="match_parent"
android:background="@color/gray">