title: glide library doesn't fill entire width first time, but works fine second time
body: <p>this is my first question here so please go easy on me...</p>
  
  <p>i have a strange problem with the image loading library Glide in my android app.</p>
  
  <p>please forgive the black squares in the screenshots, but i am under contract and am not allowed to reveal the content of the app. same goes for the code itself (i will share as much as i can).</p>
  
  <p>in my app i have a ViewPager with some fragments, and in one type of fragment i have an image which i dynamically change its' <strong>height (width stays the same)</strong> to one of 2 options (see images below).
  as the title says, i am loading that image using Glide.</p>
  
  <p>note: for each height, i have an appropriate and separate image (as to not mess with the aspect ratio), and <strong>the images are the exact same size (width X height) of the ImageView</strong>. of course every time i resize the ImageView i also load the appropriate image.</p>
  
  <p>when the image is "big", it fills the ImageView perfectly.
  the problem is that when the fragment is first displayed (default is "small" image) there is some empty space on both the right and left sides of the image - i.e. the image is not taking up the entire width of the ImageView (remember that the size of the images loaded and the size of the ImageView is the same).
  and now to the weird part: when i go back from "big" to "small" the image fits Perfectly into the ImageView without those spaces it had the first time the fragment was shown on the screen.</p>
  
  <p>in the screenshots below i have put a black square over most of the image (which i cannot reveal) except its' edges, and enabled "show layout bounds" in the developer options menu to make my problem more obvious:</p>
  
  <p>this is what the default ("small") image looks like:
  <a href="https://i.stack.imgur.com/w84jY.png" rel="nofollow noreferrer">"small" image with spaces</a></p>
  
  <p>i can only post a maximum of 2 links, so no screenshot for "big" image, but trust me- it fits perfectly into the ImageView.</p>
  
  <p>this is the image after going back from "big" to "small":
  <a href="https://i.stack.imgur.com/9xFHA.png" rel="nofollow noreferrer">"small" image without spaces</a></p>
  
  <p>here is some code:</p>
  
  <p>the relevant part of my layout:</p>
  
  <pre><code> &lt;FrameLayout
      android:id="@+id/frameLayout_sequence_presentation"
      android:layout_width="@dimen/galaxyPX1240"
      android:layout_height="@dimen/galaxyPX1185"
      android:layout_gravity="center_horizontal"
      android:layout_marginBottom="@dimen/galaxyPX100"&gt;
  
      &lt;ImageView
          android:id="@+id/imageView_sequence_presentation"
          android:layout_width="match_parent"
          android:layout_height="match_parent"/&gt;
  
       //another view containing some buttons
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>the relevant part of java:</p>
  
  <pre><code>        //some code to determine whether we are loading "big"
          //or "small" image and set the size of "newHeight" accordingly
  
          mImageView.setImageDrawable(null);
  
          Glide.with(getActivity())
               .load(pictureUrl)
               .override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
               .fitCenter() //just in case
               .into(mImageView);
  
  
          mflMediaContainer.getLayoutParams().height = newHeight;
          mflMediaContainer.requestLayout();
  </code></pre>
  
  <p>i have tried every possible combination turning these on or off: "setImageDrawable(null)", ".override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)", and ".fitCenter()" but nothing works - first time there is always empty space (and after going "big" then back to "small" - no empty space).</p>