Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/206.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android VideoView在ScrollView中填充时不展开_Android_Android Layout_Android Videoview - Fatal编程技术网

Android VideoView在ScrollView中填充时不展开

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

此视频视图不会展开并将我的视频放入视图中。如果我设置静态高度和宽度(例如640dp 400dp),视频将成功填充视图并按预期工作

这个问题是在我进入ScrollView设置后出现的——它在自己的父LinearLayout中时工作正常

VideoView的XML:

<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">