title: Android: create a drawable that shows two lines of text one above the other in different fonts and sizes?
body: <p>I want to create a single drawable that shows two lines of text, one above the other. Each line of text has to be in it's own typeface and textsize and it has to create a single drawable because I want to then set it as the drawable for a floating action button.</p>
  
  <pre><code>private void updateFloatingButtonText(String headlineText, String subHeadlineText, FloatingActionButton floatingActionButton) {
  
      int headlineTextSize = getResources().getDimensionPixelSize(R.dimen.headlineTextSize);
      int subheadlineTextSize = getResources().getDimensionPixelSize(R.dimen.subheadlineTextSize);
  
      Spannable spannableStringHeadline = new SpannableString(headlineText);
      Spannable spannableStringSubheadline = new SpannableString(subHeadlineText);
  
      CustomTypefaceSpan boldSpan = new CustomTypefaceSpan("FontOne", FontCache.get("FontOne.ttf", this));
      CustomTypefaceSpan regularSpan = new CustomTypefaceSpan("FontTwo", FontCache.get("FontTwo.ttf", this));
  
      // set typeface headline
      spannableStringHeadline.setSpan(regularSpan, 0,
              headlineText.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE
      );
  
  
      // set typeface subtitle
      spannableStringSubheadline.setSpan(boldSpan, 0,
              subHeadlineText.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE
      );
  
         // set text size headline
      spannableStringHeadline.setSpan(new AbsoluteSizeSpan(headlineTextSize), 0,
              headlineText.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE
      );
  
       // set text size subline
      spannableStringSubheadline.setSpan(new AbsoluteSizeSpan(subheadlineTextSize), 0,
              subHeadlineText.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE
      );
  
      String finalString = TextUtils.concat(spannableStringHeadline, "\n", spannableStringSubheadline);
  
      floatingActionButton.setImageDrawable([put the resulting drawable here]);
  }
  </code></pre>
  
  <p>I've written this method that creates a single string formatted exactly the way that I need it, but I still have the issue of creating a drawable out of it. </p>
  
  <p>I've tried to use this third party library, but although it displays the text in the correct typefaces it doesn't change the textsize of the lines of text.</p>
  
  <p><a href="https://github.com/devunwired/textdrawable" rel="nofollow">https://github.com/devunwired/textdrawable</a></p>
  
  <p>Is there a trivial (or nontrivial) way of doing this? </p>