title: Horizontal RecyclerView follows first item height with wrap_content
body: <p>I have a <code>RecyclerView</code> with a horizontal layout. The height of the individual adapter items can depend on the content of the item.</p>
  
  <p>So in theory it can look like the following:</p>
  
  <p><a href="https://i.stack.imgur.com/eBPJ3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eBPJ3.png" alt="enter image description here"></a></p>
  
  <p>The problem I have now is that it <code>wrap_content</code> only seems to care about the height of the first problem, because the result I am getting looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/hR7uT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hR7uT.png" alt="enter image description here"></a></p>
  
  <p>Where as you can see that the 4th item gets cut off. However, it works perfectly if I put the tallest item first.</p>
  
  <p>And to get rid of the obvious solution; I don't know the height of the items. I could only do that during testing.</p>
  
  <p>--</p>
  
  <p>adapter_item.xml</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="100dp"
      android:layout_height="wrap_content"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical"
      android:animateLayoutChanges="true"
      android:padding="@dimen/padding_view_small"&gt;
  
      &lt;ImageView
          android:id="@+id/image"
          android:layout_width="50dp"
          android:layout_height="50dp"
          android:layout_gravity="center_horizontal"
          app:srcCompat="@drawable/flamme"/&gt;
  
      &lt;TextView
          android:id="@+id/name"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textColor="@color/black"
          android:layout_marginTop="@dimen/padding_view_small"
          android:text="@string/placeholder"
          android:gravity="center_horizontal"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>parent.xml</p>
  
  <pre><code>&lt;LinearLayout
      android:id="@+id/symbol_list_parent"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:background="@drawable/container_content"
      android:padding="@dimen/padding_view_normal"&gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/symbol_list"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Activity.java</p>
  
  <pre><code>...
  final ProductPictogramAdapter symbolAdapter = new ProductPictogramAdapter();
  final View symbolListParent = findViewById(R.id.symbol_list_parent);
  RecyclerView symbolList = findViewById(R.id.symbol_list);
  symbolList.setLayoutManager(new LinearLayoutManager(ProductDetailActivity.this, LinearLayoutManager.HORIZONTAL, false));
  symbolList.setAdapter(symbolAdapter);
  symbolList.setHasFixedSize(true);
  </code></pre>