title: RecyclerView number of visible items
body: <p>I am creating a horisontal RecyclerView in my app.<br>
  It has to show 2 images on the screen at a time (so width of each image has to be 50% of the screen).<br>
  For now it works fine but each item consums all width of the screen. </p>
  
  <p>Here is my code </p>
  
  <pre><code>mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_main_ads);
          LinearLayoutManager mLinearLayoutManager = new LinearLayoutManager(getActivity());
          mLinearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
          mRecyclerView.setLayoutManager(mLinearLayoutManager);
          RecyclerViewAdapter adapter = new RecyclerViewAdapter(tmp, R.layout.lv_main_screen);
          mRecyclerView.setAdapter(adapter);
  </code></pre>
  
  <p>Here is layout of an item</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:weightSum="1"&gt;
  
      &lt;ImageView
          android:id="@+id/iv_main_ad"
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="0.5"
          android:scaleType="fitXY"
          android:src="@drawable/baner_gasoline"
          /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>As you can see I tried to use Layout_gravity="0.5",
  But it doesn't help.</p>
  
  <p>I tried to specify layout_width = ...dp but I can not get exactly half of the screen.</p>
  
  <p>I am thinking of adding another ImageView into item layout, but in this case  I will have troubles with the adapter, because I want to implemnt circled (infinity) horizontal listview</p>
  
  <p>here is my adapter:</p>
  
  <pre><code>public class RecyclerViewAdapter extends RecyclerView.Adapter&lt;RecyclerViewAdapter.MyHolder&gt; {
  
      private List&lt;Integer&gt; mImages;
      private int itemLayout;
  
      public RecyclerViewAdapter(ArrayList&lt;Integer&gt;  imageResourceIds, int itemLayout) {
          this.mImages = imageResourceIds;
          this.itemLayout = itemLayout;
      }
  
  
      @Override
      public MyHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  
          View v = LayoutInflater.from(parent.getContext()).inflate(itemLayout, parent, false);
          return new MyHolder(v);
  
      }
  
      @Override
      public void onBindViewHolder(MyHolder holder, int position) {
  
          holder.adIv.setImageResource(mImages.get(position));
  
      }
  
      @Override
      public int getItemCount() {
          return mImages.size();
      }
  
      public static class MyHolder extends RecyclerView.ViewHolder {
          protected ImageView adIv;
  
          private MyHolder(View v) {
              super(v);
              this.adIv = (ImageView) v.findViewById(R.id.iv_main_ad);
          }
      }
  }
  </code></pre>