title: Android setTextSize TextView moves baseline and cuts off text height
body: <p>I am trying to resize a TextView with the background image. I have a class that extends the TextView class, and is being added as such:</p>
  
  <pre><code>    MyCustomTextView tv2 = new MyCustomTextView(this);
      RelativeLayout.LayoutParams lparams = new          
                   RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,  
                                               LayoutParams.WRAP_CONTENT);
      lparams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
      tv2.setLayoutParams(lparams);
      myLayout.addView(v);
  </code></pre>
  
  <p>and I am zooming like so in my custom TextView class:</p>
  
  <pre><code>    public float getScaledTextHeight()
      {
          float textHeightDPI = initial_size/windowHeight_inDPI;
          float textOnScreenHeight = textHeightDPI * windowHeight_inDPI;
          float scaledText = textOnScreenHeight * mZoom;
          return scaledText;
      }
      public void setZoomTextHeight(float zoom)
      {
          mZoom = zoom;
          image_size = getScaledTextHeight();
  
          float mX = ((offset_x + img_offset_x) * mZoom);
          float mY = ((offset_y + img_offset_y) * mZoom);
          RelativeLayout.LayoutParams position1 =
                  (android.widget.RelativeLayout.LayoutParams)this.getLayoutParams();
  
          position1.leftMargin = (int)mX;
          position1.topMargin  = (int)mY;
          position1.bottomMargin  = (int)(window_height - (position1.topMargin + 
                                     image_size + 16));
          this.setLayoutParams(position1);
  
          setTextSize(TypedValue.COMPLEX_UNIT_PX , image_size);
  
          invalidate();
      }
  </code></pre>
  
  <p>What ends up happening is that making the text bigger will correctly resize the TextView, but making the text smaller will keep the same base line as when it was big. It starts to cut my text out from the bottom up.</p>
  
  <p>My question is, how can I move the base line so the bottom does not get cut off while resizing.</p>
  
  <p>Thanks in advance.</p>