Many phones and large screen devices include stylus support, and users expect seamless stylus experiences across all their apps. Your app can support stylus to provide improved navigation, drawing and handwriting capabilities, and advanced brushes with tilt and pressure detection.
Visit our large screen gallery for design and UX guidance for creativity and productivity apps.

Detecting stylus input

Guide
You can use motion events to detect whether the input type is a stylus. The MotionEvent object contains data on the tool type used, like a finger, stylus, or eraser.
Guide
A stylus pen can report events at much higher frequencies than the display. For drawing apps, use the getHistorical API to check for events in the recent past.

Set your experience apart with advanced libraries

Use the advanced stylus libraries to reduce latency, detect pressure and tilt, ignore accidental marks, and recognize handwriting.

Low latency libraries

Improve latency by reducing the processing time between stylus input and screen rendering.
Further reduce latency using prediction of future MotionEvents, made easy with our Motion Prediction Jetpack library.

Advanced libraries

Use information about the pressure and tilt of the stylus to render the stroke from the MotionEvent.
Avoid stray marks when the user accidentally touches the screen while drawing or writing with a stylus.
Recognize handwritten text and classify gestures on a digital surface with ML Kit Digital Ink Recognition.
Empower users to work in full screen and use gesture navigation without stray marks.

Build for all types of input

Empower your users to navigate your app with their stylus, just as they would with a keyboard or trackpad. Stylus optimizations also improve the experience for other types of input, like keyboard and mouse.
Guide
Help users easily identify where the focus is on the screen for precise input. For example, add a focus indicator like a thicker border when a user hovers over it.
Guide
While hovering, update the cursor to show a preview of the brush type or current action.
Guide
Drag and drop images, text, and other content so users can quickly share from your app to another app.
Guide
Make the text in your app selectable so that users can quickly select text and share with other apps with their stylus.