Awesome
Timeline View
Android view for timeline purpose. Ideally made for bank statement or sequential data, for example.
Usage
For a working implementation, please take a look at the sample
- Include library
// project/build.gradle
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
// app/build.gradle
dependencies {
implementation "com.github.anacoimbrag:timeline-view:$latest_version"
}
Add to your layout
It is very easy to use this lib, you just need to add <Timeline>
tag in your XML layout or instantiate in your code using the default constructor Timeline(context)
.
<com.anacoimbra.android.timeline.Timeline
android:layout_width="wrap_content"
android:layout_height="100dp"
app:bulletIcon="@drawable/ic_expense"
app:bulletType="round"
app:linePadding="4dp" />
Timeline Attributes
Attribute | Type | Default | Setter |
---|---|---|---|
bulletIcon | drawable | - | setIconTint(@DrawableRes Int) |
bulletIconTint | color | - | setIconTint(colorStateList) <br/> setIconTint(@ColorRes Int) |
bulletSize | dimension | 30dp | setBulletSize(@DimenRes Int) |
bulletIconPadding | dimension | 4dp | setIconPadding(@DimenRes Int) |
bulletCornerRadius <sup>1</sup> | dimension | 6dp | setBulletCornerRadius(@DimenRes Int) |
bulletBackground | color | drawable | primaryColor <br/> #7E57C2 | setBulletBackground(@ColorRes Int) <br/> setBulletBackground(@DrawableRes Int) |
bulletType | BulletType | round | bulletType = BulletType.ROUND |
bulletGravity | BulletGravity | center | bulletGravity = BulletGravity.CENTER |
lineWidth | dimension | 2dp | setLineWidth(@DimenRes Int) |
lineColor | color | colorAccent <br/> #B9B9B9 | setLineColorResource(@ColorRes Int) |
linePadding | dimension | 0dp | setLinePadding(@DimenRes Int) |
lineDashSize <sup>2</sup> | dimension | 4dp | setLineDashSize(@DimenRes Int) |
lineDashGap <sup>3</sup> | dimension | 4dp | setLineDashGap(@DimenRes Int) |
lineType | LineType | solid | lineType = LineType.SOLID |
lineVisibility | LineVisibility | both | lineVisibility = LineVisibility.CENTER |
BulletType
Code | XML | |
---|---|---|
BulletType.ICON | icon | |
BulletType.SQUARE | square | |
BulletType.CIRCLE | circle | |
BulletType.ROUND | round |
BulletGravity
Code | XML | |
---|---|---|
BulletGravity.TOP | top | |
BulletGravity.CENTER | center | |
BulletGravity.BOTTOM | bottom |
LineType
Code | XML | |
---|---|---|
LineType.SOLID | solid | |
LineType.DASHED | dashed | |
LineType.DOTTED | dotted |
LineVisibility
Code | XML | |
---|---|---|
LineVisibility.BOTH | both | |
LineVisibility.TOP | top | |
LineVisibility.BOTTOM | bottom | |
LineVisibility.NONE | none |
<sup>1 • Only works with BulletType round
</sup>
<sup>2 • Only works with LineType dashed
</sup>
<sup>3 • Only works with LineType dashed
or dotted
</sup>