2016-08-29 2 views
3

Ich habe ein Problem mit Leerzeichen in meinem Recyclerview in Scroll-Aktivität. Bitte helfen Sie mir, dieses Problem zu lösen. Ich habe alles überprüft, das ich kannte, wie keine Ränder, Paddings, versuchte, indem es den FAB entfernte. aber immer noch existiert das Problem.Mit Whistlepace-Problem mit Recyclerview in Scroll-Aktivität

Having whitespace between Appbar and recyclerview

Meine XML-Code:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    > 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/app_bar" 
     android:layout_width="match_parent" 
     android:layout_height="@dimen/app_bar_height" 
     android:fitsSystemWindows="true" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/toolbar_layout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      app:contentScrim="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       app:layout_collapseMode="pin" 
       app:popupTheme="@style/AppTheme.PopupOverlay" /> 

     </android.support.design.widget.CollapsingToolbarLayout> 
    </android.support.design.widget.AppBarLayout> 

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/id_recyclerview" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginRight="@dimen/fab_margin" 
     android:src="@android:drawable/ic_dialog_email" 
     app:layout_anchor="@id/app_bar" 
     app:layout_anchorGravity="bottom|end" /> 

</android.support.design.widget.CoordinatorLayout> 
+2

posten Sie Ihre komplette XML-Code zu entfernen, kann ich einige Teile Für mich fehlt sehen –

+2

es wie Ihre Höhe von AppBarLayout aussieht, ist größer als der Inhalt und Leerraum erscheint. Ersetzen Sie es durch Wrap-Inhalt – mhenryk

+0

@VivekMishra: vollständiger XML-Code in Frage gestellt. –

Antwort

1

Atlast ich es dachte, jetzt, Zunächst einmal Dank TWL für das Geben mir eine Idee von einer gleichen Ausgabe seines question.

Ich entfernte die android:fitsSystemWindows="true" aus der CoordinatorLayout.

Jetzt ist die Farbe der Benachrichtigungsleiste wahrscheinlich in Transparent geändert und sieht schrecklich aus. Also, ich habe in Stilen hinzugefügt.

Jetzt ist alles in Ordnung.

+1

danke, aber wenn Sie jetzt bemerken, ist die Farbe der Benachrichtigungsleiste wahrscheinlich nicht Teil der Designfarbe Ihrer App, weil es jetzt nicht mehr "unter", sondern "unter" ist . – TWL

+0

@TWL: Ja, ich habe das auch geändert, indem ich ' @ color/colorPrimary' in den Styles –

1

Try this:

<android.support.design.widget.AppBarLayout 
     android:id="@+id/app_bar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:fitsSystemWindows="true" 
     android:theme="@style/AppTheme.AppBarOverlay"> 
+0

ganze appbar gegangen. Nur Toolbar wird jetzt angezeigt –

+0

Posten Sie Ihren Recycling-Ansichtscode und xml –

2

das Versuchen von android:fitsSystemWindows="true" und android:layout_height="wrap_content"

<android.support.design.widget.AppBarLayout 
     android:id="@+id/app_bar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/AppTheme.AppBarOverlay"> 
+0

hinzugefügt habe, wenn ich 'android: layout_height =" wrap_content " 'Die Appbar wird verschwinden. –

+0

haben Sie versuchen, indem Sie 'android: fitsSystemWindows =" true "' entfernen und dann 'android: layout_height =" wrap_content "' –