How to create Formatted String programmarly

android

#1

how to create Formatted String programmarly?

I have some dynamic text to display with part of them needs to be different font. I wish to create Formatted String programmarly, can anyone instruct me how to do that?

… or how to create text with same result as:

<TextField>
    <FormattedString>
      <Span text="NativeScript" foregroundColor="#3C5AFD"></Span>
      <Span fontFamily="somefont" text=" is an "></Span>
      <Span text="AMAZING" fontSize="28" underline="true" backgroundColor="green" foregroundColor="white" fontFamily="Courier"></Span>
      <Span fontFamily="somefont2" text=" framework."></Span>
    </FormattedString>
  </TextField>

Thanks!


#2

Here you go


#3

that’s perfect!!
thank you sooooo much


#4

Sorry to bother you, but how to use it in RadListView.
I used this method in list view and all the text become the same.


#5

Assign the formatted string to a attribute in data item, bind that attribute to the textfield in template.