I Using recycler Grid view with endless scroll.i have facing new issue on recycler view last item.in first time load last list last item take additional space.when scroll top & comeback again same place it auto assign correct space.i add my issue snapshot & also added my xml file.check out & please explain what issue?
My Main xml file :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linear_detail_list_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/SIZE_5"
android:background="@color/white"
android:orientation="vertical"
tools:context="com.own.ecommerce.ui.activities.ProductDetailsListActivity">
<LinearLayout
android:id="@+id/linear_list_options"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/SIZE_5"
android:layout_marginEnd="@dimen/SIZE_10"
android:layout_marginStart="@dimen/SIZE_10"
android:layout_marginTop="@dimen/SIZE_10"
android:background="@drawable/bg_border"
android:orientation="horizontal"
android:weightSum="1">
<ImageView
android:id="@+id/img_list_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.1"
android:contentDescription="@null"
android:src="@drawable/ic_list_view" />
<LinearLayout
android:id="@+id/linear_detail_grid_sorting"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_start_product_detail_5"
android:layout_weight="0.45"
android:background="@drawable/bg_border"
android:gravity="center"
android:orientation="horizontal"
android:padding="@dimen/padding_product_detail_5"
android:weightSum="1">
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:contentDescription="@null"
android:src="@drawable/ic_sort" />
<TextView
style="@android:style/TextAppearance.Small"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:text="@string/action_sorting" />
</LinearLayout>
<LinearLayout
android:id="@+id/linear_detail_grid_filter"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.45"
android:gravity="center"
android:orientation="horizontal"
android:padding="@dimen/padding_product_detail_5"
android:weightSum="1">
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:contentDescription="@null"
android:src="@drawable/ic_filter" />
<TextView
style="@android:style/TextAppearance.Small"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:gravity="center"
android:text="@string/action_filter" />
</LinearLayout>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_grid_product_detail_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/SIZE_10"
android:layout_marginStart="@dimen/SIZE_10"
android:background="@color/white"
android:scrollbars="none" />
</LinearLayout>
My Adapter class xml :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/linear_grid_product"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_border"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.own.ecommerce.view.SquareImageView
android:id="@+id/img_grid_product"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7" />
<TextView
android:id="@+id/tv_grid_product"
style="@android:style/TextAppearance.Small"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginEnd="@dimen/SIZE_10"
android:layout_marginStart="@dimen/SIZE_10"
android:layout_weight="0.1"
android:background="@color/white"
android:gravity="start|center"
android:lines="2"
android:textColor="@color/black" />
<TextView
android:id="@+id/tv_grid_product_price"
style="@android:style/TextAppearance.Small"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_marginEnd="@dimen/SIZE_10"
android:layout_marginStart="@dimen/SIZE_10"
android:layout_weight="0.1"
android:background="@color/white"
android:gravity="start|center"
android:lines="1"
android:textColor="@color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="0.1"
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="@dimen/SIZE_10"
android:weightSum="1">
<Button
android:id="@+id/btn_grid_buy"
style="@android:style/TextAppearance.Small"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.80"
android:background="@color/black"
android:text="@string/nav_frag_home_grid_btn_name"
android:textColor="@color/white" />
<ImageView
android:id="@+id/img_grid_buy"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.20"
android:background="@color/light_black"
android:contentDescription="@null"
app:srcCompat="@mipmap/ic_cart" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
My issue images :
in first time load,
then scroll & come back again same place it's look prefect,
how i fix this issue?