title: Android AT_MOST hack - how does it work?
body: <p>I found an answer to my question in this thead: <a href="https://stackoverflow.com/questions/7067449/android-how-to-stretch-rows-in-the-gridview-to-fill-screen">android How to stretch rows in the gridview to fill screen?</a></p>
  
  <p>Indeed I do not understand how the following works:</p>
  
  <pre><code>@Override
  public void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
  {
      // HACK! TAKE THAT ANDROID!
      if (isExpanded())
      {
          // Calculate entire height by providing a very large height hint.
          // But do not use the highest 2 bits of this integer; those are
          // reserved for the MeasureSpec mode.
          int expandSpec = MeasureSpec.makeMeasureSpec(
                  Integer.MAX_VALUE &gt;&gt; 2, MeasureSpec.AT_MOST);
          super.onMeasure(widthMeasureSpec, expandSpec);
  </code></pre>
  
  <p>Is there somewhere an explanation, about why the bits where shifted, and how AT_MOST works?
  Shouldn't there be maximum size value, together with the AT_MOST flag?</p>