最後の行にPadding / Margin Bottomを追加し、最初の行にPadding / Margin Topを追加しようとしています。すべてのチャイルドに影響するため、アイテムxmlではできません。
RecyclerViewアダプターにヘッダーと子があるので、
   android:padding="4dp"
   android:clipToPadding="false"各ヘッダーの最後の最初の行で個別に使用する必要があります
最後の行にPadding / Margin Bottomを追加し、最初の行にPadding / Margin Topを追加しようとしています。すべてのチャイルドに影響するため、アイテムxmlではできません。
RecyclerViewアダプターにヘッダーと子があるので、
   android:padding="4dp"
   android:clipToPadding="false"各ヘッダーの最後の最初の行で個別に使用する必要があります
回答:
私はこれをコトリンで使用します
override fun onBindViewHolder(holder: RecyclerView.ViewHolder(view), position: Int) {
    if (position == itemsList.lastIndex){
        val params = holder.itemView.layoutParams as FrameLayout.LayoutParams
        params.bottomMargin = 100
        holder.itemView.layoutParams = params
    }else{
        val params = holder.itemView.layoutParams as RecyclerView.LayoutParams
        params.bottomMargin = 0
        holder.itemView.layoutParams = params
    }
  //other codes ...
}この問題はさらに簡単に解決できます。必要なパディングをRecylerViewそれ自体に適用clipToPaddingしてfalseに設定できます。そうしないと、パディングによってスクロール領域が途切れます。ここに例があります
<android.support.v7.widget.RecyclerView
    android:padding="4dp"
    android:clipToPadding="false"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />パディングにより、上下を含むすべての側面に4 dpが追加されます。次に、clipToPaddingパラメータを使用して、子アイテムが切り取られないようにします。次に、4dp子アイテムのすべての側面にパディングを追加します。これで問題ありません。合計で、側面およびアイテム間に8 dpのパディングが得られます。
上部と下部の両方のアイテムにパディングを追加する代わりに、RecyclerViewの上部と下部にパディングを追加して、clipToPadding属性をに設定できますfalse。
<android.support.v7.widget.RecyclerView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false"
    android:paddingTop="8dp"
    android:paddingBottom="8dp" />private class SpacesItemDecoration extends RecyclerView.ItemDecoration {
    private int space;
    public SpacesItemDecoration(int space) {
        this.space = space;
    }
    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        int position = parent.getChildAdapterPosition(view);
        boolean isLast = position == state.getItemCount()-1;
        if(isLast){
            outRect.bottom = space;
            outRect.top = 0; //don't forget about recycling...
        }
        if(position == 0){
            outRect.top = space;
            // don't recycle bottom if first item is also last
            // should keep bottom padding set above
            if(!isLast)
                outRect.bottom = 0;
        }
    }
}そして
//8dp as px
int space = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
            getResources().getDisplayMetrics()); // calculated
//int space = getResources().getDimensionPixelSize(
//    R.dimen.list_item_padding_vertical); // from resources
recyclerView.addItemDecoration(new SpacesItemDecoration(space));notifyItemInserted/ Removedは1つのアイテムのみを描画し、アイテムを削除してそれをクリーンアップするためView、他のすべての子には影響を与えないため、trueになる場合があります。たとえば、一部の項目がリストの最初にある場合(上部のパディングで描画)、新しい項目を上部に追加すると、以前は現在現在2番目の項目が引き続き上部にパディングされます...簡単な修正は、notifyDataSetChanged(force redraw を呼び出すことです。すべて...)、より複雑な場合、その項目を認識するためのロジックが必要です。これは、最初または最後の位置にあり、移動してから呼び出しますnotifyItemChanged(newPositionOfOldFirstAndOrLastItem)
                    <android.support.v7.widget.RecyclerView
    android:id="@+id/rv_tpf"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clipToPadding="false"
    android:paddingBottom="100dp" />追加android:clipToPadding="false"し、android:paddingBottom="100dp"あなたのrecyclerviewインチ
android:clipToPadding = "false"とandroid:paddingBottom = "65dp"をリサイクラービューに追加します。リサイクルメニュービューのセルでfabメニューボタンとアクションを使用している場合。
<androidx.recyclerview.widget.RecyclerView
      android:id="@+id/dinner_recycler_view"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:clipToPadding="false"
      android:paddingBottom="65dp"/>何らかの理由で、古いclipToPadding=false解決策がうまくいかない。だから私はItemDecorationを追加しました
https://gist.github.com/kassim/582888fa5960791264fc92bc41fb6bcf
public class BottomPaddingDecoration extends RecyclerView.ItemDecoration {
    private final int bottomPadding;
    public BottomPaddingDecoration(int bottomPadding) {
        this.bottomPadding = bottomPadding;
    }
    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        int position = ((RecyclerView.LayoutParams) view.getLayoutParams()).getViewLayoutPosition();
        if (position == parent.getAdapter().getItemCount() - 1) {
            outRect.set(0, 0, 0, bottomPadding);
        }
    }
}私は素晴らしい答え@snachmsmの答えをよりよく修正し、適切に使用する方法をあなたに教えます
public class SpacesItemDecoration extends DividerItemDecoration {
    private int space;
    public SpacesItemDecoration(Context clContext,int oriantation,int space) {
        super(clContext,oriantation);
        this.space = space;
    }
    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        super.getItemOffsets(outRect,view,parent,state);
        int position = parent.getChildAdapterPosition(view);
        boolean isLast = position == state.getItemCount()-1;
        if(isLast){
            outRect.bottom = space;
            outRect.top = 0; //don't forget about recycling...
        }
       /* if(position == 0){
            outRect.top = space;
            // don't recycle bottom if first item is also last
            // should keep bottom padding set above
            if(!isLast)
                outRect.bottom = 0;
        }*/
    }
}