DividerDrawable Documentation

repository·master·Indexed 19 days ago

https://github.com/nekocode/dividerdrawable

An Android library for drawing dividers on existing views using Drawables instead of new View objects to improve performance. Includes features for configuring stroke width, color, and positioning via DividerLayout, as well as utility methods for attaching dividers to views using DividerUtils.

Tokens
551
Snippets
5
Records
5
Agent score
16%

What's inside DividerDrawable

  1. Install DividerDrawable via JitPack

    master

    To use DividerDrawable in your Android project, add the JitPack repository to your repositories block and include the dependency in your dependencies block. Replace {lastest-version} with the desired version (e.g., 1.2.1).

    repositories {
        maven { url "https://jitpack.io" }
    }
    dependencies {
        compile 'com.github.nekocode:DividerDrawable:{lastest-version}'
    }
  2. Configure DividerDrawable color and stroke width

    master

    Create a new DividerDrawable instance and use the fluent API to set its visual properties, such as the stroke width and the color.

    final DividerDrawable dividerDrawable = new DividerDrawable();
    dividerDrawable.setStrokeWidth(10)
            .setColor(0xFFFFFFFF);
  3. Configure DividerDrawable layout and positioning

    master

    Use dividerDrawable.getLayout() to access DividerLayout settings. This allows you to position the divider relative to its container (View, Drawable, or Canvas) using orientation, alignment, centering, and margins.

    dividerDrawable.getLayout()
            .setOrientation(DividerLayout.ORIENTATION_VERTICAL)
            .setAlign(DividerLayout.ALIGN_PARENT_BOTTOM)
            .setCenter(DividerLayout.CENTER_HORIZONTAL)
            .setMarginBottomDp(20);