2-9 Android notes (2)

Source: Internet
Author: User

1. How many menus are available in Android?

The onoptionitemselect () method is used to click the menu option corresponding to the optionmenu.

The method for clicking the menu option corresponding to the context menu contextmenu is oncontextitemseclect (). Remember to make it dependent on a component, such as textview, when using the contextmenu, registry: registerforcontentmenu (view)

The function menu (sub-menu) submenu and option menu use the same

2. What are the development modes? What is Android used?

There are two development modes: C/S and B/S.

The former is the client and the server.

The latter is the browser and Server

There are two differences: the former requires both the client and the server to be developed, and the latter only requires the development of the server.

Android adopts the C/S development mode.

3. What is the UI?

User Interface

4. What are the differences between PX, DP, PT, and SP?

Px and DP can be used to indicate the set display of the image. PX is related to the density and will not increase as the screen grows. Therefore, DP is usually used.

PT and SP indicate the font size settings, but PT and PX are somewhat similar, both of which are related to density, so SP is more convenient.

5. What is hard encoding? In addition to hard encoding, what can be used for menu?

The menu set in the program uses hard encoding, so if you want to modify it, you need to change many places, which is inconvenient! The menu settings can be displayed in the XML layout file at one time.

6. How do I instantiate components in Android? What is the difference with Java?

In the layout file of Android, the layout component is placed and the ID is set for it. In the program, you can use the findviewbyid method to instantiate Android by yourself, different from the new in Java, the dependency is reduced!


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.