GradientView

发表于 4年以前  · 总阅读数:2001 次

GradientView

This is an Android project allowing to realize a gradient View in the simplest way possible. Finish the gradient shapes of all colors in your projects.

Android app on Google Play

USAGE

To make a gradient View add GradientView in your layout XML and add GradientView library in your project or you can also grab it via Gradle:

implementation 'com.mikhaellopez:gradientview:1.1.0'

XML

<com.mikhaellopez.gradientview.GradientView
    android:id="@+id/gradientView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:gv_direction="left_to_right"
    app:gv_end="#d32e2e"
    app:gv_start="#3f51b5" />

You must use the following properties in your XML to change your CircleView.

Properties Type Default
app:gv_start color WHITE
app:gv_alpha_start float (from 0.0 to 1.0) 1f
app:gv_end color WHITE
app:gv_alpha_end float (from 0.0 to 1.0) 1f
app:gv_direction left_to_right, right_to_left, top_to_bottom or bottom_to_top left_to_right

KOTLIN

val gradientView = findViewById<GradientView>(R.id.gradientView)
gradientView.apply {
    // Set Color Start
    start = Color.RED
    alphaStart = 0.5f

    // Set Color End
    end = Color.BLUE
    alphaEnd = 0.5f

    // Set Gradient Direction
    direction = GradientView.GradientDirection.TOP_TO_BOTTOM
}

JAVA

GradientView gradientView = findViewById(R.id.gradientView);

// Set Color Start
gradientView.setStart(Color.RED);
gradientView.setAlphaStart(0.5f);

// Set Color End
gradientView.setEnd(Color.RED);
gradientView.setAlphaEnd(0.5f);

// Set Gradient Direction
gradientView.setDirection(GradientView.GradientDirection.TOP_TO_BOTTOM);

SUPPORT ❤️

Find this library useful? Support it by joining stargazers for this repository ⭐️
And follow me for my next creations

LICENCE

GradientView by Lopez Mikhael is licensed under a Apache License 2.0.

GradientView

程序语言:JAVA

 164个收藏

 2个关注

访问GitHub主页
 目录