"The article comes from the authoritative guide for Android Application Development (fourth edition)" Some suggestions on how to design a compatible user interface (with deletions)

Source: Internet
Author: User

A book I've been reading recently is the authoritative guide to Android Application Development (fourth edition), which is highly recommended. The book describes some of the user interface design specifications, for beginners I think it is very necessary, here the code to everyone, hope for us all useful.

When we design our user interface, we always support specific device configurations by providing custom application resources and code, but it's important to note that we have to ensure that our designs have the flexibility to deal with all kinds of changes and make them simple rather than squeezing them too much. Here are some of my suggestions:

  1. Design normal-sized screens and medium-resolution apps. Over time, the device has a tendency toward greater size and greater resolution.
  2. Use fragment to keep your screen size separate from your app's activity class and provide a flexible workflow that uses Android support libraries authoring to provide updated support libraries for legacy platform versions.
  3. For the width and Height properties of view or layout, use Match_parent and wrap_content (that is, discard fill_parent) so that you can control the size of different screen sizes and direction changes. Instead of using a fixed pixel size.
  4. For dimensions, use flexible units, such as DP and SP, instead of using fixed units such as PX, MM, and in.
  5. Avoid setting and properties that are fixed with absolutelayout layouts and other pixels.
  6. Use flexible layout controls such as Relativelayout and LinearLayout, Tablayout, and framelayout to design the screen so that different screen sizes and resolutions in portrait and landscape mode are not all good to display. Try to organize your screen content using the "work with chunking" principle.
  7. Wrap the contents of the screen in an extensible container space, such as ScrollView and ListView. Normally we should scale or stretch the screen in one direction (vertical or horizontal) instead of both.
  8. Instead of providing exact positional values for screen elements, sizes, and dimensions, use relative positions, weights, and gravity directions. Spending time upfront to ensure correctness can save time in the future.
  9. Provide a graphic of reasonable high-quality applications and always maintain the original (larger) size to ensure that no version of the graphics can be used in the future for the unused resolution. There is always a tradeoff between graphics quality and file size. Find a suitable point to ensure that the graphics are scaled reasonably in different screen features without significant application or long time load display. Better, it is recommended to use the Nine-patch graphic, which allows the graphic to change size depending on the size of the display area

Hope that some of the above development norms can help everyone.

BOB

"The article comes from the authoritative guide for Android Application Development (fourth edition)" Some suggestions on how to design a compatible user interface (with deletions)

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.