Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/turskyi/fingerdrawing
This sample demonstrates how to create a custom View that allows the user to draw on the screen with their finger.
https://github.com/turskyi/fingerdrawing
android educational kotlin sample-app xml
Last synced: 27 days ago
JSON representation
This sample demonstrates how to create a custom View that allows the user to draw on the screen with their finger.
- Host: GitHub
- URL: https://github.com/turskyi/fingerdrawing
- Owner: Turskyi
- Created: 2020-06-29T14:42:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-07-28T21:49:11.000Z (5 months ago)
- Last Synced: 2024-07-28T22:42:10.863Z (5 months ago)
- Topics: android, educational, kotlin, sample-app, xml
- Language: Kotlin
- Homepage: https://github.com/Turskyi/FingerDrawing
- Size: 1.12 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct-single.svg)](https://stand-with-ukraine.pp.ua)
# Finger Drawing Sample
This sample demonstrates how to create a custom View that allows the user to
draw on the screen with their finger.## Value:
This project provides a clear and concise example of:
- Creating a custom View by extending the View class.
- Handling touch events to capture user input.
- Using Canvas and Paint to draw on the screen.
- Creating a simple drawing application.
This sample can be used as a starting point for creating more complex custom
Views or for learning about touch event handling and drawing in Android.## Implementation Details:
The SignatureView class is a custom View that extends the View class. It uses
a Paint object to define the color and style of the drawing and a Path object
to store the user's drawing path.The onTouchEvent() method is overridden to handle touch events. When the user
touches the screen (ACTION_DOWN), the starting point of the path is set. As
the user moves their finger (ACTION_MOVE), the path is updated and the view is
invalidated to redraw the screen.The onDraw() method is overridden to draw the path on the Canvas using the
Paint object.## Usage:
To use the SignatureView, simply add it to your layout XML file:
```xml
```
This will create a full-screen drawing area where the user can draw with their
finger.## Screenshot:
## Contact:
For any inquiries or suggestions, please open an issue on the GitHub repository
or reach out to me directly at
[[email protected]](mailto:[email protected]).