title: ImageSpan.ALIGN_BASELINE when TextView has lineSpacing
body: <p>I want to align my <code>ImageSpan</code> to the baseline of the text, but I also need to add some spacing between the lines.<br>
  The problem is that when I add line spacing, the <code>ImageSpan</code> doesn't align to the baseline of the text, but to the <code>baseline+lineSpacing</code>, so it's appearing lower than it should.  </p>
  
  <p>Is there a workaround to this ?  </p>
  
  <p><strong>Edit:</strong> Further explanation :  </p>
  
  <ol>
  <li><p>How it looks like <em>without</em> <code>lineSpacing</code> ( the arrow is the <code>ImageSpan</code>). It's correctly aligned to the baseline.<br>
  <img src="https://i.stack.imgur.com/kjsQX.png" alt="enter image description here"></p></li>
  <li><p>How it looks like if I add <code>android:lineSpacingMulitiplier="1.2"</code><br>
  <img src="https://i.stack.imgur.com/QaQjQ.png" alt="enter image description here">   </p></li>
  </ol>
  
  <p><strong>Edit 2</strong> The code:<br>
  XML:</p>
  
  <pre><code>&lt;com.kushtrim.example.views.CustomTypefaceTextView
      android:id="@+id/descId"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:lines="3"
      android:gravity="center_vertical"
      android:layout_marginLeft="@dimen/_45"
      android:layout_marginTop="@dimen/_6"
      android:layout_marginBottom="@dimen/_20"
      app:font_type="merriweather_regular"
      android:textSize="@dimen/f40"
      android:lineSpacingMultiplier="1.2"
      android:textColor="@color/black"
      android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit."
      android:ellipsize="end" /&gt;
  </code></pre>
  
  <p>Other relevant methods:  </p>
  
  <pre><code>    private Spannable getContentText(ContactRaport contactRaport) {
      DateTime dateTime = new DateTime(contactRaport.contactDate);
  
      String datePart = dateTime.getDayOfMonth() + " " + dateTime.monthOfYear().getAsShortText(new Locale("nl")) + "; ";
      String completeText = datePart + contactRaport.note;
  
      Typeface font1 = Typeface.createFromAsset(context.getAssets(), "MyFont1.ttf");
      Typeface font2 = Typeface.createFromAsset(context.getAssets(), "MyFont2.ttf");
      SpannableStringBuilder  spannable = new SpannableStringBuilder("XX");
      ImageSpan arrow = getArrowImageSpan(contactRaport);
      spannable.setSpan(arrow, 0, 2, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
      spannable.append(completeText);
  
      spannable.setSpan(new CustomTypefaceSpan("", font1 ), 2, datePart.length()+1, Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
      spannable.setSpan(new CustomTypefaceSpan("", font2), datePart.length(), completeText.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
      spannable.setSpan(new ForegroundColorSpan(getContentDateColor(contactRaport)),2, datePart.length()+1, 0);
  
      return spannable;
  }
  </code></pre>
  
  <p>.  </p>
  
  <pre><code>private ImageSpan getArrowImageSpan(ContactRaport contactRaport) {
  
      Drawable d = null;
      switch (contactRaport.type) {
          ... logic to load the correct drawable
      }
  
  
     d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
  
      return new ImageSpan(d, ImageSpan.ALIGN_BASELINE);
  }
  </code></pre>