title: Android - Add Margin for SpannableStringBuilder using ReplacementSpan
body: <p>I'm trying to format Hashtags inside a TextView/EditText (Say like Chips mentioned in the Material Design Specs). I'm able to format the background using <code>ReplacementSpan</code>. But the problem is that I'm not able to increase the line spacing in the TextView/EditText. See the image below
  <a href="https://i.stack.imgur.com/lWTfk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lWTfk.png" alt="enter image description here"></a></p>
  
  <p>The question is how do I add top and bottom margin for the hashtags? </p>
  
  <p>Here is the code where I add the background to the text:</p>
  
  <pre><code>   /**
       * First draw a rectangle
       * Then draw text on top
       */
      @Override
      public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) {
          RectF rect = new RectF(x, top, x + measureText(paint, text, start, end), bottom);
          paint.setColor(backgroundColor);
          canvas.drawRoundRect(rect, CORNER_RADIUS, CORNER_RADIUS, paint);
          paint.setColor(textColor);
          canvas.drawText(text, start, end, x, y, paint);
      }
  </code></pre>