All Projects → Comcast → DahDit

Comcast / DahDit

Licence: Apache-2.0 license
Custom Views for drawing Dotted and Dashed Lines without jumping through hoops.

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Labels

DahDit - Better Dots and Dashes in Android

Drawing a round-dotted line or a dashed line with a shape drawable in Android requires you to disable hardware rendering due to some bugs. It also doesn't play nice with wrap_content. Let's not worry about that anymore.

Usage

You can use com.xfinity.dahdit.DottedLine or com.xfinity.dahdit.DashedLine as a view in XML. By default, the line will be drawn horizontally, with dots of diameter 4dp with minimum 2dp spacing.

Spacing

The library will calculate the correct amount of spacing to add between dots in order to ensure the dots are flush to the ends of your included View.

Customizable

The View can have the dot's radius, dash's height/width, the minimum gap between dots/dashes, the color, and the orientation of the line customized in XML.

In Action

Here's what the sample app looks like if you launch it:

Demo showing appearances

Note the ImageView using wrap_content can't be seen at all. Meanwhile, all the dashed and dotted lines fit nicely, and flush their dots/dashes to the edge of their view.

Using DahDit

DahDit is available on MavenCentral. To use DahDit, in your project build.gradle add

compile 'com.xfinity:dahdit:0.9.3'
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].