2017-02-23 1 views
0

Warum nimmt die VideoView so viel Platz ein?Warum nimmt das VideoView-Widget fast die volle Höhe ein?

Meine RecyclerView enthält einen Kopfteil (für die VideoView) und einen Artikel Teil.

Header

Sie versuchte es mit match_parent und wrap_content aber das Ergebnis war immer noch das gleiche zu beheben.

Direkt unter dem Video (im grauen Bereich) sollte der ListItems sein. Mindestens eine, die Sie am unteren Bildschirmrand sehen können.

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> 

Antwort

0

ändern RelativeLayout Tag android:layout_height="match_parent" von item.xml und header.xml zu android:layout_height="wrap_content"

+0

versuchte ich das auch, aber dann der 'VideoView' nicht mehr angezeigt wird. – user3350744

Verwandte Themen