Das ProblemRecyclerView zeigt nicht alle Elemente innerhalb Fragment
In meinem Activity
initialisieren ich ein Fragment
, die eine RecyclerView
enthält. Aber ich habe erkannt, dass es nicht alle Artikel anzeigt. Das bedeutet, dass anstelle von 14 nur 11 Elemente angezeigt werden. Darüber hinaus wird die letzte sichtbare Element (Nummer 12) abgesägt
Meine Implementierung
Die Activity
eine leere FrameLayout
enthält, die als Fragment
Behälter wirkt:
<?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="match_parent"
android:background="#e0e0e0">
<LinearLayout
android:id="@+id/layout_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/layout_border_white"
android:paddingBottom="@dimen/footer_padding">
<include layout="@layout/footer"></include>
</LinearLayout>
<FrameLayout
android:id="@+id/fragment_start"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/layout_footer"/>
</RelativeLayout>
Und hier ist die RecyclerView in dem Fragment:
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e0e0e0"
android:orientation="vertical">
<LinearLayout
android:id="@+id/layout_header"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:padding="@dimen/startpage_padding"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<include layout="@layout/header"></include>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/startpage_margin"
android:scrollbars="vertical"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/layout_header"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ProgressBar
android:id="@+id/pb_loading_indicator"
android:layout_width="@dimen/startpage_progressbar"
android:layout_height="@dimen/startpage_progressbar"
android:visibility="invisible"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_error_message_display"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:padding="@dimen/startpage_text_padding"
android:text="@string/error_message"
android:textSize="@dimen/startpage_text"
android:visibility="invisible"/>
</LinearLayout>
Lösungsansätze
ich schon versucht, es mit match_parent
im RecyclerView
und auch eine paddingBottom
ihm hinzugefügt. Mit paddingBottom = "30dp" ist ein weiteres Element sichtbar, aber das ist keine gute Lösung. Desweiteren verwendet mein Activity
das AlertDialog
-Thema, das in Manifest
eingestellt ist. Das Entfernen zeigt das gleiche Ergebnis.
Jede Hilfe würde sehr geschätzt werden.
ändern 'android: layout_above = "@ id/layout_footer"' auf 'android: layout_above = "@ + id/layout_footer"' Auch warum verwenden Sie 'App: layout_constraintTop_toBottomOf = "@ + id/layout_header" 'für' RecyclerView' – Piyush
Danke für den Hinweis, aber das hat nicht geholfen. Ich verwende 'app: layout_constraintTop_toBottomOf =" @ + id/layout_header "' zum Positionieren, da das 'RecyclerView' in einem 'ConstraintLayout' liegt. –
Was ist die übergeordnete Ansicht des RecyclerView? –