cancel
Showing results for 
Search instead for 
Did you mean: 

Set different color in TextView

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

pokrakam
Active Contributor
0 Kudos

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.
Former Member
0 Kudos

Well, the question is how i can change the color inside an string ? e.g. i have 3 lines in an string field, which i bind to the textView.

Line 1

Line 2

Line 3

I only want to set the first line to another color, and leave line 2 and 3 black. Question is, if this is possible.

br Martin

pokrakam
Active Contributor
0 Kudos

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.