GridLayoutManager - column width wrap its own largest child
<p>I got a <code>RecyclerView</code> inside an <code>HorizontalScrollView</code> and I want it to use a <code>GridLayoutManager</code>. This is ok but one thing still bother me, the width of every columns are the same (based on the largest cell width I suppose?). Isn't it possible to wrap width of columns to match the largest cell of this specific column?</p>

<p>It should look to something like this :</p>

<p><a href="https://i.stack.imgur.com/b2xL4.png"><img src="https://i.stack.imgur.com/b2xL4.png" alt="enter image description here"></a>  </p>

<p>Where the orange part is the part taken by the cell's view.</p>

<hr>

<p><strong>EDIT</strong></p>

<p>We asked me to clarify what I expect. An example is better than words, here you can see a screenshot of a RecyclerView with GridLayoutManager. Each item is a simple TextView containing randomly a text between 10 &amp; 40 characters. The RecyclerView is inside an HorizontalScrollView as said before. We can see that every columns have the same width, despite the fact that no items in this column may fulfill the entire width. What I would like is to remove those useless empty space and having columns with different sizes with each column matching the width of its own largest child.</p>

<p><a href="https://i.stack.imgur.com/d4RkB.png"><img src="https://i.stack.imgur.com/d4RkB.png" alt="enter image description here"></a></p>

<p>If you want to test this behavior, you may clone this repo I uploaded on Github : <a href="https://github.com/ShargotthDev/TestGrid">https://github.com/ShargotthDev/TestGrid</a></p>

<p>As asked, here is my XML layout (very basic) :</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;

    &lt;HorizontalScrollView
        android:id="@+id/gameplay_hotizontalScroll_ScrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="70dp"&gt;

        &lt;android.support.v7.widget.RecyclerView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/recycler_view" /&gt;

    &lt;/HorizontalScrollView&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<hr>

<p><strong>EDIT 2</strong></p>

<p>I should have mentioned that some of the cells may have a span size > 1 and the LayoutManager should be vertical so that those cells take more places horizontally and not vertically (don't know if I'm making myself understandable).</p>

<p>Thank's for your time !</p>