Giter Club home page Giter Club logo

androidgradientui's Introduction

Qucik Setup

1. Include library

Using AndroidStudio

Edit your build.gradle file and add below dependency:

dependencies {
    compile 'com.david.gradientuilib:gradientuilibrary:1.0.1'
}

2. Using in layout.xml

GradientIconView

First the custom attribute should declare in xml like this:

xmlns:app="http://schemas.android.com/apk/res-auto"

Then you can add GradientIconView in layout.xml

<com.david.gradientuilibrary.GradientIconView
    android:id="@+id/id_iconfont_chat"
    app:bottom_icon="@mipmap/chats"
    app:top_icon="@mipmap/chats_green"
    android:layout_width="40dp"
    android:layout_height="35dp" />

The GradientIconView can gradient change itself from top_icon to bottom_icon. GradientIconView will show top icon completely like this:

gradientIconView.setIconAlpha(1.0f);

And it will show bottom icon completely like this:

gradientIconView.setIconAlpha(0);

GradientTextView

You can add GradientTextView in layout.xml like this.

<com.david.gradientuilibrary.GradientTextView
    android:id="@+id/id_chats_tv"
    app:bottom_text_color="@color/tab_text_gray"
    app:text="@string/chats"
    app:text_size="12sp"
    app:top_text_color="@color/tab_bg_green"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

The GradientTextView can gradient change itself textcolor from top_text_color to bottom_text_color. GradientIconView will show top textcolor completely like this:

gradientTextView.setTextViewAlpha(1.0f);

And it will show bottom textcolor completely like this:

gradientTextView.setTextViewAlpha(0);

3. Running effect

androidgradientui's People

Contributors

wangdong20 avatar

Watchers

James Cloos avatar  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.