Android programming: interface composition, event listener, and android listener
Knowledge: Interface Composition and event listener
==== Interface Composition ====
1. The basic components of the user interface, called View, are inherited from the android. view. View class. Many basic interface components are predefined in Android, such
Buttons, CheckBox, ProgressBar and TextView, which are generally called components or components (widgets or components)
2. Of course, a View can be composed of multiple other View components. This is called ViewGroup, which inherits the android. view. ViewGroup class, but it itself
It also inherits the android. view. ViewGroup class and acts as a parent view to accommodate other child views)
3. Another ViewGroup is the layout we often call layout manager. It is a container view, such as RelativeLayout and TableLayout.
4. View hierarchy is a tree structure. Each sub-view is a branch of the parent view until the leaf (widgets or components)
For example, view layout:
View level:
=== View event listener ====
CommonThe event listener is as follows:
OnClickListenerUsed to respond to click events
OnLongClickListenerUsed to respond to long-pressed events
OnTouchListenerUsed to respond to touch events, such as multiple gestures.
OnFocusChangeListenerTerm Response focus transfer event
OnKeyListenerUsed to respond to keyboard button events