Dependencies and prerequisites
- Android 2.1 (API level 7) or higher
You should also read
- Custom Components
- Input Events
- Property Animation
- Hardware Acceleration
- Accessibility developer guide
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 ADT layout editor.
- Custom Drawing
- Make your view visually distinctive using the Android graphics system.
- 使视图可交互
- 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.
- 优化视图
- 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.