Ich versuche, ein RecyclerView-Element Layout erstellen, wo eine Kind-Viewgroup sollte die Höhe des Elements sein in so zum Beispiel habe ich ein 250dp Höhe Element und ich habe ein LinearLayout, dessen Höhe ist auf match_parent
eingestellt sollte seine Höhe auch 250dp sein.Make Child ViewGroup Match Elternhöhe RecyclerView
Dies scheint nicht der Fall zu sein, wenn ich versuche, dies zu tun, scheint die Linearlayout Höhe
dies wrap_content
gezwungen zu werden, ist mein Beispiel Layout ich mit
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_toLeftOf="@+id/ll"
android:background="@color/android_green">
</RelativeLayout>
<LinearLayout
android:layout_width="175dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:id="@+id/ll"
android:layout_alignParentRight="true"
android:background="@color/android_red">
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
zu testen, bin mit Ich sehe nur das LinearLayout, wenn ich eine harte Höhe (250dp) festlege, wenn ich es in match_parent ändere, verschwindet es.
Ist das mit RecyclerView nicht mehr möglich?
können Sie Erforsche ein wenig mehr, mit welchem Problem du konfrontiert wirst? –
@subrahmanyamboyapati das lineare Layout ist mot die Höhe der Zelle entspricht es immer nur die Höhe des Inhalts – tyczj
'RelativeLayout' ist ein Schmerz manchmal, vor allem beim Verschachteln. Versuchen Sie, die 'layout_alignParentTop'- und' layout_alignParentBottom'-Attribute von 'LinearLayout' auf 'true' zu setzen. –