arjinmc / Android-DashLine

a custom view for dash line with several colors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android-DashLine

a custom view for dash line with several colors

It's easy to use.

in xml

<com.arjinmc.dashcolorline.DashLine
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:dashGap="6dp"
        app:dashWidth="50dp"
        app:orientation="horizontal"
        app:thickness="10dp" />

You can change your colors by edite DashLine.java

private int[] mColors = {Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW};

or in Activity/Fragment/View

 ((DashLine) findViewById(R.id.dashline_h))
                .setColors(Color.GRAY, Color.parseColor("#23d290"));

You also can use setXXXX to change these attributes as above in the xml file.

If you set the dashGap to zero,you will see a solid line.

About

a custom view for dash line with several colors

License:Apache License 2.0


Languages

Language:Java 100.0%