This is an implementation of a view which you can use to draw anything you want on it.
You can download it as an AAR here.
You can use it as dependency in your gradle file:
implementation 'com.github.golovin47.drawingview:drawingview:1.0.0'
If you're using maven:
<dependency>
<groupId>com.github.golovin47.drawingview</groupId>
<artifactId>drawingview</artifactId>
<version>1.0.0</version>
<type>aar</type>
</dependency>
This is just a simple view, so you can add it to your layout.xml or create in code.
You can change paint color in code:
setPaintColor(R.color.black)
and
setPaintColor("#FF000000")
or add attribute in layout.xml:
app:paintColor="@android:color/black"
You can change line thickness in code:
setLineThickness(10f)
or add attribute in layout.xml:
app:lineThickness="10"
You can set background color in code:
setCanvasBackgroundColor(R.color.white)
and
setCanvasBackgroundColor("#FF000000")
or add attribute in layout.xml:
app:backgroundColor="@android:color/white"
You can undo your previously drawn path:
undo()
You can easily get bitmap of everything, DrawingView contains:
getBitmap()
DrawingView is released under the MIT license. Visit https://opensource.org/licenses/MIT for details.