Skip to Content
avatar image
Former Member

Set different color in TextView

Hi,

i have a TextView in my web dynpro abap application. there we have the property "semanticColor". i can also bind this property.

But how can i use this semanticColor inside my coding to set different colors in the TextView depending on the content of my xstring i put inside the TextView ? I mean how to set the color dynamicly inside the web dynpro application ?

br Martin

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 24, 2017 at 07:19 AM

    Binding is one part, you then also need to update the bound context attribute that now represents the color.

    You can do this via the usual methods, wddoinit, wddomodifyview, onaction..., supply_...

    if <textviewvalue> = foo. 
        <colorvalue> = ...
      else. 
        <colorvalue> = ...
    endif.
    Add comment
    10|10000 characters needed characters exceeded

    • Sorry, that wasn't clear in your question. You want to apply multiple colors to parts of the same text.

      This is not possible with a TextView, you will have to use a FormattedTextView and generate the formatting up front. See app demo_uiel_formatted_text_edit for an example.