0

Iリサイクラを使用しています。無限のscroll.iを使用したグリッドビューでは、リサイクラビューの最後のアイテムに新しい問題が発生しています。最後のリストを最後にロードする最後のアイテムを追加します。スクロールトップ&再度同じ場所に自動的に戻します。私の問題のスナップショット&も私のXMLファイルを追加しました。&どうしたらいいですか?Recyclerビュー最後のアイテムはより多くのスペースを取っていますか?

私のメインのxmlファイル:

<?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> 

マイアダプタクラスの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> 

私の問題画像:初めてのロードで

enter image description here

はその後、再び、それは知事を見ますと同じ場所に来る私はこの問題を解決する方法 enter image description here

&スクロール?

+0

親線形レイアウトから親線形レイアウトから第2の線形レイアウトへandroid:weightSum = "1" –

答えて

0

ルートLinearLayoutにbottomMarginがあります。

android:layout_marginBottom="@dimen/SIZE_5" 

あなたは「match_parent」としてあなたのルートのLinearLayoutの高さを設定し、「1」としてあなたrecyclerviewの体重を行う必要があります。

+0

あなたの提案で私のコードを変更しました。しかし、私は新しいものに直面しています。最後のアイテムはスペースを得られませんが、同じ高さです。最後の項目は同じ高さです。私は何ができますか? –

関連する問題