Giter VIP home page Giter VIP logo

timelineview's Introduction

TimelineView

This library provide android View to add Timeline to your application.

image

Download

Via gradle:

dependencies {
	compile 'com.github.alorma:timelineview:2.3.0'
}

Usage

Add View to your layout

<Layout 
    xmlns:app="http://schemas.android.com/apk/res-auto">
...
<com.alorma.timeline.RoundTimelineView
	android:id="@+id/timeline1"
   	android:layout_width="?android:listPreferredItemHeight"
   	android:layout_height="?android:listPreferredItemHeight"
   	app:timeline_indicatorSize="20dp"
   	app:timeline_lineStyle="linear"
   	app:timeline_type="middle"/>
...
</Layout>

Or

<Layout 
    xmlns:app="http://schemas.android.com/apk/res-auto">
...
<com.alorma.timeline.SquareTimelineView
	android:id="@+id/timeline1"
   	android:layout_width="?android:listPreferredItemHeight"
   	android:layout_height="?android:listPreferredItemHeight"
   	app:timeline_indicatorSize="20dp"
   	app:timeline_lineStyle="linear"
   	app:timeline_type="middle"/>
...
</Layout>

Custom attributes

Line

Attr name Attr format Example
timeline_lineWidth dimension 20dp
timeline_lineColor color @color/red / #FF0000
timeline_lineStyle enum dashed / linear
timeline_type enum hidden / start / middle / line / end

Indicator

Attr name Attr format Example
timeline_indicatorSize dimension 20dp
timeline_indicatorColor color @color/red / #FF0000
timeline_alignment enum start / middle / end
timeline_drawInternal boolean true / false
timeline_internalColor color @color/red / #FF0000
timeline_internalDrawable reference @drawable / @color
timeline_internalPadding dimension 20dp

Advanced - Custom shape

If you want to create a new shape for indicator (like a diamond), you can! Just extends TimelineView and implement the following methods:

protected abstract void drawIndicator(Canvas canvas, Paint paintStart, float centerX,
	float centerY, float size);
protected abstract void drawInternal(Canvas canvas, Paint paintInternal, float centerX,
	float centerY, float size);
protected abstract void drawBitmap(Canvas canvas, float left, float top, int size);

Contributors

License

TimelineView by Bernat Borras is licensed under a Apache License 2.0.

timelineview's People

Contributors

alorma avatar hrules6872 avatar ceduliocezar avatar adamnilssonsofthouse avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.