Android Question Custom Styling a String

Discussion in 'Android Questions' started by shashkiranr, Jun 17, 2015.

  1. shashkiranr

    shashkiranr Active Member Licensed User

    Hi All,

    The awesome rich string lib allow to style a string only with basic fonts and not custom fonts. I came across a blog which used the below code to style a string using custom font. Is there any way it can be achieved in B4A ?

    Code:
    SpannableString s = new SpannableString("My Title");
        s.setSpan(new TypefaceSpan(this, 
    "MyTypeface.otf"), 0, s.length(),
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    Regards,
    SK
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Do you want to use several different fonts in the same label? This is not possible with the RichString library.
     
  3. shashkiranr

    shashkiranr Active Member Licensed User

    No Erel. Just one but its not a font its in the action bar title. hence i need the SpannableString. Is there a way to achieve the above posted code in b4a ?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Not without using inline java.
     
Loading...