DeveloperPaul123 / StarView

🌟Simple custom star view for Android🌟
MIT License
9 stars 1 forks source link
android android-custom-view android-library android-view custom-view developerpaul123 kotlin kotlin-android star star-view starview

StarView

:star2: Simple custom view that draws an n-point star for Android.

Say Thanks Discord Jitpack android-arsenal

Features

Include in your project

Gradle

Add the following to your root build.gradle:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Then add the dependency to your module's build.gradle file:

dependencies {
    implementation 'com.github.DeveloperPaul123:StarView:<version>'
}

Usage

Add the StarView to your layout xml:

<com.developerpaul123.starview.StarView
            android:id="@+id/starView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:minHeight="350dp"
            app:fillPercentage="0.5"
            app:outlineThickness="4.0" />

Other available attributes:

Attribute Value Type(s) Description
fillDirection StarView.FillDirection Control what direction the star is filled from.
fillPercentage float, clamped to 0.0 -> 1.0 Control the fill percentage.
numberOfPoints int, minimum of 3 Control the number of points in the star.
outlineThickness float Control the outline thickness.
starColor Color The fill color of the star.
starOutlineColor Color The outline color of the star.
starBackgroundColor Color The background color of the star. Only visible when not filled.
starCornerRadius float The corner radius for the points of the star.

All of the above attributes can be controlled via XML and Kotlin. See the demo application for more options and how they affect the view.

Contributing

Contributions are very welcome. Please see contribution guidelines for more info.

License

The project is licensed under the MIT license. See LICENSE for more details.

Author

br><sub>@DeveloperPaul123</sub