Giter Site home page Giter Site logo

gradienttextview's Introduction

GradientTextView 效果

grad

GradientTextView 功能

  • GradientTextView是一个文字颜色逐步改变的自定义view,目前只有两种颜色。

如何使用 GradientTextView

  • Step 1. Add it in your root build.gradle at the end of repositories:
  allprojects {
    	repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
  • Step 2. Add the dependency
 dependencies {
            compile 'com.github.livesun:GradientTextView:v1.0'
	}
  • Step 3 xml布局
<gradient.mylibrary.GradienTextView
        android:id="@+id/gradienTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        app:originalCololr="@color/colorPrimary"
        app:change_color="@color/colorAccent"
        android:textSize="15sp"
        />
  • Step 4 代码调用
//简单使用

 GradienTextView gradienTextView = (GradienTextView) findViewById(R.id.gradienTextView);
 gradienTextView.start(Orientation.LEFT_TO_RIGHT,1000);
 
 
 //也可以自定义
 
  gradienTextView.setOrientation(Orientation.LEFT_TO_RIGHT);
        ValueAnimator animator = ValueAnimator.ofFloat(new float[]{0.0F, 1.0F});
        animator.setDuration(2000);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            public void onAnimationUpdate(ValueAnimator animation) {
                float value = ((Float)animation.getAnimatedValue()).floatValue();

                gradienTextView.setCurrentProgress(value);
            }
        });
        animator.start();
        
        
    //也可以静态展示
    
     gradienTextView.start(Orientation.LEFT_TO_RIGHT,1000);
     gradienTextView.setCurrentProgress(0.5f);

##有问题反馈 在使用中有任何问题,欢迎反馈给我,可以用以下联系方式跟我交流

gradienttextview's People

Contributors

livesun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.