Get the App
SLTechnology News&Howtos  ›  Development  › 

How to set the color and direction of TextView gradient and animation effect in Android

Shulou Source: shulou.com Published: 2022-06-02 17:02:42 11月16日 Update

This article mainly introduces how to set the color and direction of TextView gradient and animation effects in Android. It is very detailed and has certain reference value. Interested friends must finish reading it!

Add dependency

Previously, the repository was released on jcenter, but the migration has been completed recently because it is about to become unavailable. It is recommended that you use the configuration of mavenCentral.

Use jcenter

Implementation 'com.williamyang:gradienttext:1.0.1'

Use mavenCentral

Preview of buildscript {repositories {mavenCentral ()}} implementation 'io.github.weilianyang:gradienttext:1.0.1' effect:

1. Control style 2. Property introduction property optional value function gradient_ startColor value defines the start value of the gradient color in color.xml (default: # 6200EE) gradient_ endcolor value defines the end value of the gradient color in color.xml (default: # 03DAC5) gradient_directionleftToRight: from left to right TopToBottom: direction of gradient color from top to bottom (default: leftToRight) animation switch of gradient_animatetrue or false gradient color (default: false) animation speed of gradient color of gradient_speedslow, normal, fast (default: normal). Control the animation switch gradientTextView.apply {translateAnimate =! translateAnimate invalidate ()} in the code. These are all the contents of the article "how to set the color and direction of TextView gradient and animation effects in Android" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Color animation effects orientation content properties controls articles warehouses code values roles interests guys buddies layouts suggestions more styles knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft OPPO Reno NVidia vpn Huawei