0

i have set margin using RecyclerView.ItemDecoration class and it's working in English properly but when i changed my language to Arabic its not working i have using support for left and right support in menifest file.

Here is my class

 public class ProductMarginSetting extends RecyclerView.ItemDecoration {


    @Override
    public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
        super.getItemOffsets(outRect, view, parent, state);

        if (parent.getChildAdapterPosition(view) == parent.getAdapter().getItemCount() - 1) {
            outRect.right = 24; /* set your margin here */
        }

        if (parent.getChildAdapterPosition(view) == 0) {
            outRect.left = 24; /* set your margin here */
        }

      }
    }

Arabic version (not working) , English version (working)

Thanks

Aqib
  • 843
  • 1
  • 5
  • 5
  • 1
    Here's an answer that might help you: https://stackoverflow.com/a/39941479/5288316 – Nicolas Jun 09 '20 at 23:54
  • @Nicolas thanks buddy i got what need, i just modified the above linked code as per my requirement, – Aqib Jun 10 '20 at 07:19

0 Answers0