2015-06-28 37 views
7

enter image description here Wir können sehen, hier ist der letzte Artikel teilweise sichtbar. Wie kann ich das beheben? layout.xmlRecyclerView Abschneiden letzten Artikel

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 
    android:id="@+id/coordinator_layout" 
    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="wrap_content" 
    android:fitsSystemWindows="true"> 

    <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/ThemeOverlay.AppCompat.Dark.ActionBar"> 

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

      <include 
       layout="@layout/header" 
       android:fitsSystemWindows="true" 
       app:layout_collapseMode="parallax"/> 

      <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/ThemeOverlay.AppCompat.Light"/> 
     </android.support.design.widget.CollapsingToolbarLayout> 
    </android.support.design.widget.AppBarLayout> 

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

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

list_item.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/grey_background"> 

    <ImageView 
     android:id="@+id/image" 
     android:layout_width="@dimen/thumbnail_width" 
     android:layout_height="@dimen/thumbnail_height" 
     android:layout_gravity="center" 
     android:adjustViewBounds="true" 
     android:scaleType="fitCenter"/> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerVertical="true" 
     android:layout_toRightOf="@id/image" 
     android:orientation="vertical" 
     android:padding="@dimen/participant_left_padding"> 

     <TextView 
      android:id="@+id/participants_name" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="name" 
      android:textColor="@android:color/white"/> 

     <TextView 
      android:id="@+id/total_view" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="view" 
      android:textColor="@android:color/white"/> 

     <TextView 
      android:id="@+id/ranking" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="ranking" 
      android:textColor="@android:color/white"/> 
    </LinearLayout> 

    <ImageView 
     android:id="@+id/overflow" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:src="@drawable/ic_action_overflow"/> 
</RelativeLayout> 
+2

try Höhe von recyclerview ändern – Lester

+0

@Lester Dank für die schnelle Antwort auf match_parent. Mit match_parent ist die Liste nicht sichtbar und das Minimieren funktioniert auch nicht. – Vivart

+0

Gut gemacht @Lester –

Antwort

8

@Lester hatte recht Problem RecyclerView der wrap_content Höhe war. Aber das Ändern von match_parent funktionierte nicht, weil. Dieses Layout wurde zu einem Fragment hinzugefügt, und dieses Fragment wurde als wrap_content deklariert. Also habe ich die Höhe und die Größe des Recycler Views von fragment auf parent_parent geändert und das Problem jetzt gelöst.

<fragment 
     android:id="@+id/fragment" 
     android:name="com.example.fragment" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"/> 
+1

Ich habe auch das gleiche Problem, aber die Änderung hat nicht geholfen. –

4

Ich habe auch ein Problem. Meiner Meinung nach geschah dies, weil Sie das AppBarLayout XML-Attribut android: fitsSystemWindows = "true" gesetzt haben. Um dies zu lösen, ich gebe den RecyclerView Rand unten gleich Aktionsleiste Größe

<android.support.v7.widget.RecyclerView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     android:id="@+id/recyclerView" 
     android:layout_marginBottom="?attr/actionBarSize"> 
Verwandte Themen