It is possible to create custom views
by:
Compound views - combining views with a default wiring
Custom views - creating your own views
a) by extending an existing view, e.g. Button, TextView, EditText, ListView, CheckBox, RadioButton, Gallery, Spinner, AutoCompleteTextView, ImageSwitcher, and TextSwitcher.
b) by extending the View class
Creating custom views
By extending the View class
or one of its subclasses
you can create your custom view
.
Creating your own View subclasses gives you precise control over the appearance and function of a screen element.
For drawing view use the onDraw()
method. In this method you receive a Canvas object
which allows you to perform drawing operations on it, e.g. draw lines, circle, text or bitmaps. If the view should be re-drawn you call the invalidate()
method which triggers a call to the onDraw()
method of this view.
If you define own views, ensure you review the ViewConfiguration
class, as it contains several constants for defining views.
To draw your Views you typically use the 2D Canvas API
.