RecyclerView horizontal wrap_content max size
<p>I have a RecyclerView (image below) and I have some content (a picture and some text) loading from an API. I'd like all the rows to be exactly the same height, but the text could vary wildly in length. So the yellow box should be bigger to match the green box which has more text. If that makes sense?</p>

<p><a href="https://i.stack.imgur.com/6GO4C.png" rel="nofollow"><img src="https://i.stack.imgur.com/6GO4C.png" alt="picture A"></a></p>

<p>Currently, I'm using a LinearLayoutManager set to Horizontal, but I've also tested with a GridLayoutManager with 1 row which produces the same effect.</p>

<p>I'm also using setAutoMeasureEnabled to true.</p>

<ol>
<li><p>Is there a simple way to do this with a RecyclerView?</p></li>
<li><p>If not, how would be best to calculate the height and send it down to each ViewHolder?</p></li>
</ol>

<p>Thank you,</p>

<p>As requested:</p>

<p>my initialisation which is in the MainActivity onCreate: </p>

<pre><code>mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    mRecyclerView.setHasFixedSize(true);

    // use a linear layout manager
    mLayoutManager = new GridLayoutManager(MainActivity.this, 1, GridLayoutManager.HORIZONTAL, false);
    mLayoutManager.setAutoMeasureEnabled(true);

    mRecyclerView.setLayoutManager(mLayoutManager);

    setUpSomeData();

    TopFilmsCard card1 = (TopFilmsCard)cards.get(0);
    mAdapter = new FilmsAdapter(card1.getFilms());
    mRecyclerView.setAdapter(mAdapter);
</code></pre>

<p>FilmsAdapter</p>

<pre><code> private class FilmsAdapter
        extends RecyclerView.Adapter&lt;FilmsCardHolder&gt; {

    private List&lt;Film&gt; films;

    public FilmsAdapter(List&lt;Film&gt; films) {
        this.films = films;
    }

    @Override
    public int getItemViewType(int position) {
        return R.layout.holder_top_films;
    }

    @Override
    public FilmsCardHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        return new FilmsCardHolder(LayoutInflater.from(MainActivity.this).inflate(R.layout.holder_film, parent, false));
    }

    @Override
    public void onBindViewHolder(FilmsCardHolder holder, int position) {
        holder.bindCard(films.get(position));
    }

    @Override
    public int getItemCount() {
        return films.size();
    }
}
</code></pre>

<p>FilmsCardHolder</p>

<p>public class FilmsCardHolder extends RecyclerView.ViewHolder {</p>

<pre><code>public FilmsCardHolder(View itemView) {
    super(itemView);
}


public void bindCard(Film film) {

    ViewGroup layout = (ViewGroup)itemView.findViewById(R.id.layoutFilm);
    TextView lblFilm = (TextView)itemView.findViewById(R.id.lblFilmName);
    ImageView imgPicture = (ImageView)itemView.findViewById(R.id.imgPicture);

    layout.setBackgroundResource(film.getColor());
    lblFilm.setText(film.getName());
    imgPicture.setImageResource(film.getPicture());


}
</code></pre>

<p>}</p>

<p>activity_main.xml</p>

<pre><code> &lt;RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/activity_main"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;

  &lt;android.support.v7.widget.RecyclerView
      android:id="@+id/recyclerView"
      android:scrollbars="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="#CCD1D9"/&gt;
</code></pre>

<p></p>

<p>holder_film</p>

<pre><code>  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/layoutFilm"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical"
  android:background="#5D9CEC"&gt;

  &lt;TextView
      android:id="@+id/lblFilmName"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:gravity="center_horizontal"
      android:padding="10dp"
      android:textSize="22sp"/&gt;

  &lt;ImageView
      android:id="@+id/imgPicture"
      android:layout_width="100dp"
      android:layout_height="100dp"
      android:layout_gravity="center_horizontal"
      /&gt;
</code></pre>

<p></p>