Android recycvler view layout mismatch between preview and actual layout -


i'm working on graduation work , prior including custom toolbar (for hamburger icon) , replacing listview navigationview drawerlayout menu items i've had no problems layouts @ all. preview , desired, expected result recyclerviewpreview in android studio

and actual view on android device (letv x800 api21 if matters @ all) actual view

as can see gap between consecutive items huge , don't know source of problem. i'm using single activity xml contains frame container desired layouts loaded. fragment_car_cost.xml

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:fab="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/car_cost_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="left" android:orientation="vertical">  <space     android:layout_width="match_parent"     android:layout_height="15dp"     android:id="@+id/space"/>  <android.support.v7.widget.recyclerview     android:id="@+id/car_cost_entry_recycler_view"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_marginleft="16dp"     android:layout_marginright="16dp"     android:layout_below="@id/space"     app:layoutmanager="linearlayoutmanager"     tools:listitem="@layout/item_car_cost">  </android.support.v7.widget.recyclerview>  <com.github.clans.fab.floatingactionmenu     android:id="@+id/car_cost_floating_action_menu"     android:layout_width="match_parent"     android:layout_height="wrap_content"     fab:menu_animationdelayperitem="55"     fab:menu_backgroundcolor="@android:color/transparent"     fab:menu_buttonspacing="0dp"     fab:menu_colornormal="#da3c2f"     fab:menu_colorpressed="#dc4b3f"     fab:menu_colorripple="#99d4d4d4"     fab:menu_fab_label="opcje"     fab:menu_fab_size="normal"     fab:menu_icon="@drawable/fab_add"     fab:menu_labels_colornormal="#333"     fab:menu_labels_colorpressed="#444"     fab:menu_labels_colorripple="#66efecec"     fab:menu_labels_cornerradius="3dp"     fab:menu_labels_ellipsize="none"     fab:menu_labels_hideanimation="@anim/fab_slide_out_to_right"     fab:menu_labels_margin="0dp"     fab:menu_labels_maxlines="-1"     fab:menu_labels_padding="8dp"     fab:menu_labels_position="left"     fab:menu_labels_showanimation="@anim/fab_slide_in_from_right"     fab:menu_labels_showshadow="true"     fab:menu_labels_singleline="false"     fab:menu_labels_textcolor="#f2f1f1"     fab:menu_labels_textsize="15sp"     fab:menu_opendirection="up"     fab:menu_shadowcolor="#66aff198"     fab:menu_shadowradius="4dp"     fab:menu_shadowxoffset="1dp"     fab:menu_shadowyoffset="4dp"     fab:menu_showshadow="true"     android:layout_alignparentbottom="true"     android:layout_alignstart="@+id/car_cost_entry_recycler_view">      <com.github.clans.fab.floatingactionbutton         android:id="@+id/btn_car_costs_add"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:src="@android:drawable/ic_input_add"         fab:fab_label="@string/add"         fab:fab_size="mini" />      <com.github.clans.fab.floatingactionbutton         android:id="@+id/btn_car_costs_statistics"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:src="@android:drawable/ic_menu_my_calendar"         fab:fab_label="@string/statistics"         fab:fab_size="mini" />      <com.github.clans.fab.floatingactionbutton         android:id="@+id/btn_car_costs_charts"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:src="@android:drawable/btn_dropdown"         fab:fab_label="@string/charts"         fab:fab_size="mini" /> </com.github.clans.fab.floatingactionmenu> </relativelayout> 

activity_main.xml

<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/layout_drawer" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">  <relativelayout     android:layout_width="match_parent"     android:layout_height="match_parent"     >      <android.support.v7.widget.toolbar         android:id="@+id/toolbar"         android:layout_width="match_parent"         android:layout_height="wrap_content" />      <framelayout         android:id="@+id/main_frame"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_below="@id/toolbar" /> </relativelayout>  <android.support.design.widget.navigationview     android:id="@+id/navigation_view"     android:layout_width="240dp"     android:layout_height="match_parent"     android:layout_gravity="left"     app:headerlayout="@layout/navigation_header"     app:menu="@menu/menu_navigation" />   </android.support.v4.widget.drawerlayout> 

and recycler view item:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/car_cost_header" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginbottom="7sp" android:orientation="horizontal" android:weightsum="1">  <android.support.v7.widget.cardview xmlns:card_view="http://schemas.android.com/apk/res-auto"     android:id="@+id/car_cost_entry_card_view"     android:layout_width="match_parent"     android:layout_height="wrap_content"     card_view:cardcornerradius="2dp"     card_view:cardelevation="4dp">      <relativelayout         android:layout_width="match_parent"         android:layout_height="wrap_content">          <imageview             android:id="@+id/cost_type_image_view"             android:layout_width="75sp"             android:layout_height="75sp"             android:src="@android:drawable/ic_menu_today"             android:longclickable="true"/>          <textview             android:id="@+id/car_cost_entry_date_text_view"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_torightof="@id/cost_type_image_view"             android:text="17.08.2017 17:20"             android:textappearance="?android:attr/textappearancemedium" />          <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_below="@+id/car_cost_entry_date_text_view"             android:layout_toendof="@+id/cost_type_image_view"             android:text="typ: paliwo"             android:textappearance="?android:attr/textappearancemedium"             android:id="@+id/car_cost_entry_type_text_view" />          <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="koszt: 666,66zł"             android:textappearance="?android:attr/textappearancemedium"             android:layout_below="@+id/car_cost_entry_type_text_view"             android:layout_toendof="@+id/cost_type_image_view"             android:id="@+id/car_cost_entry_cost_text_view"/>          <imageview             android:id="@+id/cost_details_image_view"             android:layout_width="wrap_content"             android:layout_height="40sp"             android:src="@android:drawable/ic_menu_delete"             android:clickable="true"             android:layout_alignparentright="true"             />      </relativelayout> </android.support.v7.widget.cardview>   </linearlayout> 

change main linearlayout height wrap_content in recyclerview item layout

<linearlayout ...             ...     android:layout_width="match_parent"     android:layout_height="wrap_content"     ...     ... > 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -