2017-08-30 2 views
-1

Ich arbeite an einer Ansicht, die mit dem Koordinatorlayout gescrollt werden muss und in der sie eine Recycleransicht haben sollte. Ich habe mehrere Antworten versucht, aber es hat überhaupt nicht funktioniert. Unter dem Recycler-Ansichtsbereich befindet sich noch immer ein leerer Bereich.Leerer Raum unterhalb des Koordinatorlayouts

Hier ist meine activity.xml

<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" 
    tools:context="com.woi.adeisme.MainActivity" 
    android:background="#ff0000" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.design.widget.AppBarLayout 
     android:fitsSystemWindows="true" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <LinearLayout 
      app:layout_scrollFlags="scroll" 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <LinearLayout 
       android:orientation="vertical" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <TextView 
        android:text="Masa?" 
        android:paddingTop="60dp" 
      android:paddingBottom="60dp" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" /> 

      </LinearLayout> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"/> 

     </LinearLayout> 

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

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/recyclerView" 
     android:background="#0000ff" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     android:fitsSystemWindows="true" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:padding="0dp" 
     android:layout_margin = "0dp"> 

    </android.support.v7.widget.RecyclerView> 
</android.support.design.widget.CoordinatorLayout> 

ich versucht habe: 1. Satz layout_height = match_parent/Verpackung Inhalt 2. fitsSystemWindow 3. Fillport und dies immer noch nicht funktioniert ..

kann mir jemand helfen?

the red one is the empty space

+0

Haben Sie Platz (nur ein Punkt auf einem Bildschirm zeigen)? oder haben Sie Platz am Ende von RecycleView? –

+0

share screenshot .. – Omi

+0

Wie sieht die Ausgabe * Runtime * aus? Zeig uns. –

Antwort

0

versuchen Linear Layout statt CoordinatorLayout wie darunter

helfen kann zwischen jedem Element
<LinearLayout 
android:orientation="vertical" 
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:background="#ff0000" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<android.support.design.widget.AppBarLayout 
    android:fitsSystemWindows="true" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <LinearLayout 
     app:layout_scrollFlags="scroll" 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <TextView 
       android:text="Masa?" 
       android:paddingTop="60dp" 
       android:paddingBottom="60dp" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" /> 

     </LinearLayout> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"/> 

    </LinearLayout> 

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


<android.support.v7.widget.RecyclerView 
    android:id="@+id/recyclerView" 
    android:background="#0000ff" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    android:fitsSystemWindows="true" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:padding="0dp" 
    android:layout_margin = "0dp"/> 

    <!-- <include layout="@layout/useless_content"/>--> 

</LinearLayout> 
Verwandte Themen