Android programming: interface composition, event listener, and android listener

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.