title: Adding ArrayList to recyclerView
body: <p>I'm trying to add an ArrayList to my RecyclerView. The problem is that it's not setting up anything, only blank spaces are present.</p>
  
  <p>The code for my mainActivity is</p>
  
  <pre><code>ArrayList&lt;String&gt; Size = new ArrayList&lt;&gt;(Arrays.asList(SizeArrayFinal));
  
  rec = (RecyclerView)findViewById(R.id.SizeRecycler);
  rec.setHasFixedSize(true);
  rec.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
  sizeConstructorList = new ArrayList&lt;&gt;();
  
  for (int i = 0; i &lt;= Size.size(); i++){
     SizeConstructor sizeConstructor = new SizeConstructor(Size);
     sizeConstructorList.add(sizeConstructor);
  }
  
  recAdapter = new SizeAdapter(sizeConstructorList,getApplicationContext());
  rec.setAdapter(recAdapter);
  </code></pre>
  
  <p>The code for my Adapter class is</p>
  
  <pre><code>public class SizeAdapter extends RecyclerView.Adapter&lt;SizeAdapter.ViewHolder&gt; {
  
      private List&lt;SizeConstructor&gt; sizeConstructorList;
      private Context context;
  
      public SizeAdapter(List&lt;SizeConstructor&gt; sizeConstructorList, Context context) {
          this.sizeConstructorList = sizeConstructorList;
          this.context = context;
      }
  
      @Override
      public SizeAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View view = LayoutInflater.from(parent.getContext())
                  .inflate(R.layout.size_view, parent, false);
          return new ViewHolder(view);
      }
  
      @Override
      public void onBindViewHolder(SizeAdapter.ViewHolder holder, int position) {
          SizeConstructor sizeConstructor = sizeConstructorList.get(position);
          holder.button1.setText(sizeConstructor.getSize());
      }
  
      @Override
      public int getItemCount() {
          return sizeConstructorList.size();
      }
  
      public class ViewHolder extends RecyclerView.ViewHolder{
  
          public TextView button1;
  
          public ViewHolder(View itemView) {
              super(itemView);
  
              button1 = (TextView)itemView.findViewById(R.id.SizeButton);
          }
      }
  }
  </code></pre>
  
  <p>And finally my constructor class is</p>
  
  <pre><code>public class SizeConstructor {
  
      String Size;
  
      public SizeConstructor(ArrayList&lt;String&gt; sizeArray) {
      }
  
      public SizeConstructor(String size) {
          Size = size;
      }
  
      public String getSize() {
          return Size;
      }
  }
  </code></pre>
  
  <p>The issue is that the code is not setting the values in the recyclerView.</p>
  
  <p>Please refer to the image below to see the issue.
  <a href="https://i.stack.imgur.com/rwYEd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rwYEd.png" alt="This is the reference Image"></a></p>
  
  <p>Moreover there is a huge Gap below which is not required as i was setting the orientation to be horizontal.
  Any help would be great as I have to submit this project really soon.</p>
  
  <pre><code>RecycleView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.HORIZONTAL, false);
  </code></pre>
  
  <p><code>rec.setLayoutManager(layoutManager);</code></p>
  
  <p>After i added this line....it is again showing just the first textView instead of complete arrayList.</p>
  
  <p>I wanted to make the layout horizontal.
  I tried to add tge code for horizontal layout im XML file but it wasn't making it horizontal....</p>