We have a requirement to show text fading in from the top of the screen.
To do this, I placed a Filled rectangle on top of the views and set the top colours to #000000FF
I then set the bottom colours to #00000000
In the designer, I could see the text 'fading in' from the top as expecting.
Press F7 - the gradiant vanishes.
The rectangle is on top of a Attributed Text View.
As soon as I press F7 or run this view, the opacity vanishes. It seems like it's just using the 'color' and not anything else.
I just tried this with a blank project:
By changing the colours I can get the effect I want, but running it or pressing F7 gets the result on the right.
Am I missing something or doing something wrong?
I appear to have found the issue here:
The 'Color' property is set to the value set in the designer last, and this clears the gradient. (So the corners are set, followed by Color)
// The color does not change -> Nothing to do.
if (( value == pure ColorTL ) &&
( value == pure ColorTR ) &&
( value == pure ColorBL ) &&
( value == pure ColorBR ))
As this gets called last and this conditional is FALSE as the corners are different colours to the value passed in.
This means this gets called:
pure ColorTL = value;
pure ColorTR = value;
pure ColorBL = value;
pure ColorBR = value;
Hence the corner colours are reset and the gradient doesn't get shown. I guess this means I'll have to set the gradient in code rather than rely on the design time property setting?
(This is using 9.20)