android - How can I remove space at top of the 'recycleview's layout'? -


<?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"     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="180dp"         android:fitssystemwindows="true">             <android.support.v7.widget.toolbar                 android:id="@+id/toolbar"                 android:layout_width="match_parent"                 android:layout_height="180dp"                 app:layout_scrollflags="scroll|enteralways">                 <textview                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:text="dddddddasdfaf2fdsafdd"/>                 </android.support.v7.widget.toolbar>     </android.support.design.widget.appbarlayout>     <android.support.v7.widget.recyclerview         android:id="@+id/recycler_view"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:cliptopadding="true"         app:layout_behavior="@string/appbar_scrolling_view_behavior"/> </android.support.design.widget.coordinatorlayout> 

list_item.card.xml

<android.support.v7.widget.cardview xmlns:android="http://schemas.android.com/apk/res/android"                                     xmlns:card_view="http://schemas.android.com/apk/res-auto"                                     android:layout_width="match_parent"                                     android:layout_height="80dp"                                     card_view:cardelevation="5dp"                                     card_view:cardmaxelevation="5dp"                                     card_view:cardpreventcorneroverlap="true"                                     card_view:cardusecompatpadding="true">      <relativelayout         android:layout_width="match_parent"         android:layout_height="80dp">          <imageview             android:id="@+id/thumbnail"             android:layout_width="100dp"             android:layout_height="80dp"             android:layout_alignparentleft="true"             android:layout_centervertical="true"             android:background="#00ff00"             android:scaletype="centercrop"/>          <textview             android:id="@+id/title"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_centervertical="true"             android:layout_torightof="@+id/thumbnail"             android:maxlines="3"             android:padding="8dp"             android:text="dafdafda"             android:textcolor="#222"             android:textsize="15dp"/>      </relativelayout> </android.support.v7.widget.cardview> 

layoutmonitor captured image

i make layout coordinatorlayout , recyclerview. building , launching succes. have small problem. see capture image, there space above recyclerview. seems recyclerview's space(top margin), never defined margin or padding.

how remove top space margin?

i don't know why layout_height in appbarlayout , toolbar set value..

but, try 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"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:fitssystemwindows="true">      <android.support.design.widget.appbarlayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:theme="@style/mytheme.appbaroverlay">          <android.support.v7.widget.toolbar             android:id="@+id/toolbar"             android:layout_width="match_parent"             android:layout_height="?attr/actionbarsize"             android:background="?attr/colorprimary"             app:popuptheme="@style/mytheme.popupoverlay">              <textview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="dddddddasdfaf2fdsafdd" />         </android.support.v7.widget.toolbar>      </android.support.design.widget.appbarlayout>      <android.support.v7.widget.recyclerview         android:id="@+id/recycler_view"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:cliptopadding="true"         app:layout_behavior="@string/appbar_scrolling_view_behavior" />  </android.support.design.widget.coordinatorlayout> 

and see result

enter image description here


Comments