From Unreliable Frog, 4 Years ago, written in Java.
Embed
  1.         int transY = bottom - b.getBounds().bottom;
  2.         if (mVerticalAlignment == ALIGN_BOTTOM) {
  3.             transY = bottom;
  4.         } else { // mVerticalAlignment == ALIGN_BASELINE
  5.             transY = y;
  6.         }
  7.         transY -= b.getBounds().bottom;
  8.