title: Scale Image to Fit in EditText
body: <p>I am appending an image into an EditText and using the ImageGetter class to set the scale. At the moment I am simply using the width and height of the image as seen in ImageGetter below at</p>
  
  <pre><code>d.setBounds(0,0, d.getIntrinsicHeight(), d.getIntrinsicWidth() );
  </code></pre>
  
  <p>However, I would like the image set to fit the EditText width and then scale to the proper height so that the image does not appear distorted. I've researched but have yet to locate the proper methods to make this work</p>
  
  <p>Appending method:</p>
  
  <pre><code>public void appendToMessageHistory(String username, String message) {
          if (username != null &amp;&amp; message != null) {
  
              messageHistoryText.append(Html.fromHtml("&lt;b&gt;" + username + ":"
                      + "&lt;/b&gt;" + "&lt;br&gt;"));
              messageHistoryText.append(Html.fromHtml(message + "&lt;hr&gt;" + "&lt;br&gt;")
                      + System.getProperty("line.separator") + "");
              messageHistoryText.append(Html.fromHtml("&lt;img src = '" + getResources().getDrawable(R.drawable.img1) +"'/&gt;", imageGetter, null));
  
          }
      }
  </code></pre>
  
  <p>ImageGetter:</p>
  
  <pre><code>    // To get the images you are submitting
      ImageGetter imageGetter = new ImageGetter() {
          @Override
          public Drawable getDrawable(String source) {
              Drawable d = getResources().getDrawable(
                      R.drawable.img1);
              d.setBounds(0,0, d.getIntrinsicHeight(), d.getIntrinsicWidth() );
              return d;
          } 
  
      };
  </code></pre>