Small details to be noticed during Android Development

Source: Internet
Author: User

1. The main UI thread cannot be updated in the Child thread. It must be updated using the Handler, AsyncTask, or View postDelay () method.

2. The Toast cannot be displayed in the Child thread. (This is similar to the first point)

3. If an activity is set to the singletask mode. This will affect the sequence of startActivityForResult () calls. Therefore, onActivityResult () cannot be used normally ().

4. The scaleType attribute of ImageVIew is invalid for the src attribute and must be set to the background attribute.

5. Differences between android: layout_gravity and android: gravity

From the name, we can see that android: gravity refers to the element itself, and the text of the element itself is displayed in any place by changing the attribute settings, but not set to the left by default.

Android: layout_gravity is relative to its parent element, indicating where the element is displayed.

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.