title: Fit ImageViews into Android GridLayout
body: <p>I need to place 4 images into <code>GridLayout</code>. If I define their sizes hard-coded.</p>
  <p>e.g.</p>
  <pre><code>android:layout_width=&quot;150dp&quot;
  android:layout_height=&quot;200dp&quot;
  </code></pre>
  <p>It works fine.
  But my question is, if is it possible to do it without defining sizes?
  Meanwhile I've tried this:</p>
  <pre><code>&lt;GridLayout
      android:layout_width=&quot;0dp&quot;
      android:layout_height=&quot;0dp&quot;
      android:layout_margin=&quot;16dp&quot;
      android:columnCount=&quot;2&quot;
      android:orientation=&quot;horizontal&quot;
      android:useDefaultMargins=&quot;true&quot;
      app:layout_constraintTop_toBottomOf=&quot;@+id/top_object&quot;
      app:layout_constraintBottom_toTopOf=&quot;@+id/bottom_object&quot;
      app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
      app:layout_constraintRight_toRightOf=&quot;parent&quot;&gt;
  
          &lt;ImageView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&quot;
              android:src=&quot;@drawable/poster_21&quot;
              android:scaleType=&quot;centerCrop&quot;/&gt;
  
          &lt;ImageView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&quot;
              android:src=&quot;@drawable/poster_22&quot;
              android:scaleType=&quot;centerCrop&quot;/&gt;
  
          &lt;ImageView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&quot;
              android:src=&quot;@drawable/poster_23&quot;
              android:scaleType=&quot;centerCrop&quot;/&gt;
  
          &lt;ImageView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&quot;
              android:src=&quot;@drawable/poster_24&quot;
              android:scaleType=&quot;centerCrop&quot;/&gt;
  
    &lt;/GridLayout&gt;
  </code></pre>
  <p>But in this case I have left top image occupies the whole Grid Layout and 3 other images have the same size and are located outside the screen.</p>
  <img src="https://i.stack.imgur.com/DQiV6.png" width="950"/>