简体   繁体   中英

Why is VideoView widget taking almost full height?

Why is the VideoView taking up so much space?

My RecyclerView contains of a header part (for the VideoView ) and an item part.

头

It tried to fix it with match_parent and wrap_content but the result was still the same.

Right below the video (in the gray area) should be the ListItems . At least one you can see at the bottom of the screen.

main.xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context=".MainActivity">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipToPadding="false"
        android:paddingBottom="80dp"
        android:scrollbars="vertical"/>
</FrameLayout>

item.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical" android:layout_width="match_parent"
              android:layout_height="match_parent">

    <TextView
        android:id="@+id/textViewItem"
        android:textSize="22sp"
        android:layout_marginRight="12dp"
        android:layout_marginLeft="57dp"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="8dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</RelativeLayout>

header.xml

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <VideoView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:id="@+id/videoViewHeader"/>
</RelativeLayout>

item.xmlheader.xml的 RelativeLayout标记android:layout_height="match_parent" 更改android:layout_height="wrap_content"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM