目录

How do I implement the text gradient effect?

Symptom

When linearGradient is set, the background color gradient instead of the text gradient is used by default. How to implement the text gradient?

Possible Causes

The linearGradient attribute is used for the component content and is drawn on the background. Therefore, if the attribute is set only for text, the effect is displayed on the background color instead of the text. The effect is as follows:

Solution

To implement the text gradient effect, use the following methods:

1. Versions earlier than API20

2. Versions later than API20

For more text effects, see Text Effects Based on the Text Component and Common Properties.