Skip to content
Android library that lets you draw on it. πŸ–ŒπŸŽ¨
Kotlin
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
canvasview
example
gradle/wrapper
.gitignore
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

CanvasView

Android library that lets you draw on it.

Add library to project:

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency

dependencies {
        implementation 'com.github.imabhishekkumar:CanvasView:1.0'
}

Implementation

In XML layout

 <dev.abhishekkumar.canvasview.CanvasView
    	android:id="@+id/canvasView"
    	android:layout_width="match_parent"
    	android:layout_height="match_parent"/>

Set background color, marker color, and stroke width

val canvasView = findViewById<CanvasView>(R.id.canvasView)
    canvasView.setColorBackground(R.color.colorPrimary)
    canvasView.setColorMarker(R.color.colorAccent)
    canvasView.setStrokeWidth(12f)

Get/Set Bitmap from/to view

canvasView.getBitmap()
canvasView.setBitmap(bitmap)

Clear view

canvasView.clearView()
You can’t perform that action at this time.