title: Why my ImageView would not change width in Android?
body: <p>I'm developing an Android app with avatar (the image icon), the ImageView is inside an RelativeLayout like this </p>
  
  <pre><code>   &lt;ImageView
          android:id="@+id/indicators"
          android:layout_width="@dimen/conversation_avatar_size"
          android:layout_height="@dimen/conversation_list_left_indicator_height"
          android:layout_below="@id/contact_image"
          android:layout_alignWithParentIfMissing="true"
          android:layout_marginEnd="@dimen/smaller_def_margin"
          android:layout_marginTop="@dimen/smaller_def_margin"
          android:scaleType="fitCenter"
          tools:src="@drawable/ic_reply"/&gt;
  </code></pre>
  
  <p>However, I cannot change the width of this ImageView when I make the contact_image invisible because indicator takes less space. The code is like below</p>
  
  <pre><code>            indicators.getLayoutParams().width = width;
              indicatorsWidth = indicators.getWidth();
              indicators.requestLayout();
  </code></pre>
  
  <p>After <code>indicators.requestLayout();</code> the width of the indicator still keeps the old one not changed to width. I'm wondering why this can happen? I also tried <code>indicators.setLayoutParams(layoutParams);</code> but still doesn't work. 
  I did find some interesting, even though <code>indicators.getWidth()</code> is still the old value, <code>indicators.getLayoutParams().width</code> is the new width now, and ImageView size doesn't change at all.
  Update : I found what <code>view.getWidth()</code> is, and then I used <code>indicators.setLeft()</code> and <code>indicators.setRight()</code>, this time <code>indicators.getWidth()</code> is also the new width, however, the size still doesn't change, I checked it and found that <code>indicators.getMeasuredWidth()</code> is still the old value, any idea?</p>