title: Adjust ViewBounds of ImageView when parent layout contents overflow
body: <p>I've a vertical LinearLayout containing following widgets displayed in center with LinearLayout's gravity set to "center":</p>
  
  <ul>
  <li>ImageView</li>
  <li>TextInputLayout</li>
  <li>TextInputLayout</li>
  <li>Button</li>
  </ul>
  
  <p>This looks fine normally when when on smaller screen devices, the button in bottom is going out of view. This goes even worst when I display <strong>error</strong> for both TextInputLayouts.</p>
  
  <p><strong>Screenshots Normal Screens:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/S1BlN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S1BlN.png" alt="On Normal Screens"></a></p>
  
  <p><strong>Screenshots Small Screens:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Fw28n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fw28n.png" alt="On Small Screens"></a></p>
  
  <p><strong>PROBLEM:</strong></p>
  
  <p>What I want is that on small screens, the ImageView should resize itself to accommodate all views, while on bigger screens, ImageView should keep its maximum available size while all contents appear in center (as in Screenshot 1).</p>
  
  <p>Any help would be greatly appreciated! :)</p>
  
  <p><strong>SOURCE XML:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout 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"
      android:layout_margin="@dimen/input_view_margin"
      android:gravity="center"
      android:orientation="vertical"&gt;
  
      &lt;ImageView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          app:srcCompat="@drawable/ic_transaction_history_big" /&gt;
  
      &lt;TextView
          style="@style/ReportHeading"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/txt_transaction_history" /&gt;
  
      &lt;android.support.v4.widget.Space
          android:layout_width="wrap_content"
          android:layout_height="40dp" /&gt;
  
      &lt;TextInputLayout
          android:id="@+id/wrapperFromDate"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;TextInputEditText
              android:id="@+id/edtFromDate"
              style="@style/InputLayoutEditText"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:focusable="false"
              android:hint="@string/hint_from_date" /&gt;
      &lt;/TextInputLayout&gt;
  
      &lt;TextInputLayout
          android:id="@+id/wrapperToDate"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginTop="10dp"&gt;
  
          &lt;TextInputEditText
              android:id="@+id/edtToDate"
              style="@style/InputLayoutEditText"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:focusable="false"
              android:hint="@string/hint_to_date" /&gt;
      &lt;/TextInputLayout&gt;
  
      &lt;Button
          android:id="@+id/btnSubmit"
          style="@style/PrimaryButton"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginTop="35dp"
          android:text="@string/action_submit" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>