Skip to content

Most visited

Recently visited

navigation

Creating Custom Views

Dependencies and prerequisites

  • Android 2.1 (API level 7) or higher

You should also read

Try it out

Download the sample

CustomView.zip

The Android framework has a large set of View classes for interacting with the user and displaying various types of data. But sometimes your app has unique needs that aren’t covered by the built-in views. This class shows you how to create your own views that are robust and reusable.

Lessons

Creating a View Class
Create a class that acts like a built-in view, with custom attributes and support from the Android Studio layout editor.
Custom Drawing
Make your view visually distinctive using the Android graphics system.
Making the View Interactive
Users expect a view to react smoothly and naturally to input gestures. This lesson discusses how to use gesture detection, physics, and animation to give your user interface a professional feel.
Optimizing the View
No matter how beautiful your UI is, users won't love it if it doesn't run at a consistently high frame rate. Learn how to avoid common performance problems, and how to use hardware acceleration to make your custom drawings run faster.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.