Ich stehe vor diesem seltsamen Problem, wo mein recycleview wrap_content in der Höhe ist, aber es nimmt die volle Höhe des Bildschirms, während mein Inhalt nur die Hälfte des Bildschirms Platz einnimmt. Ich habe gelesen, dass dies ein Fehler war und in 23.2.1 behoben ist. Ich verwende: -Recycledview wrap_content issue
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
Im xml auch, habe ich nicht etwas Bestimmtes hinzugefügt: -
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="@dimen/margin_10"
android:layout_marginLeft="@dimen/margin_20"
android:layout_marginRight="@dimen/margin_20"
android:layout_marginTop="@dimen/margin_10"
android:layout_weight="1">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycleview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FF0000" />
</android.support.v4.widget.SwipeRefreshLayout>
<include layout="@layout/layout_circular_progress_bar" />
</FrameLayout>
Wie Sie aus dem Bild sehen können mein Inhalt ist nur die Hälfte, der runde weiße Teil und der untere rote Teil ist extra. Wie entferne ich das?
Der erste Punkt arbeitete in recyclerview.setlayoutmanager verwenden. Legen Sie ein lineares Layout mit Gewicht 1 fest –