Simple android library for drawing
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the gradle dependency to your app
module build.gradle
file:
dependencies {
compile 'com.github.ajithvgiri:Canvas-Library:v1.1.1'
}
Make sure layout_width
and layout_height
are match-parent
. and make sure the background of the layout must be white
<RelativeLayout
android:id="@+id/parentView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF" />
RelativeLayout parentView = findViewById(R.id.parentView);
CanvasView canvasView = new CanvasView(this);
parentView.addView(canvasView);
To clear the drawing
canvasView.clearCanvas();