2017-02-23 52 views
0

爲什麼VideoView佔用這麼多空間?爲什麼VideoView組件幾乎佔滿了整個高度?

我的RecyclerView包含一個標題部分(用於VideoView)和一個項目部分。

Header

它試圖與match_parentwrap_content修復,但結果還是一樣。

正下方的視頻(在灰色區域)應該是ListItems。您至少可以在屏幕底部看到一個。

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> 

回答

0

變化RelativeLayout標籤item.xmlheader.xml的android:layout_height="match_parent"android:layout_height="wrap_content"

+0

我試過太多,但那麼'VideoView'不再被顯示。 – user3350744

相關問題