Original address: juejin.cn/post/684490…

The following is your screen adaptation to upgrade! Series of articles, welcome to forward and share:

  • SAO year your screen adaptation way should upgrade! (I) – Toutiao Adaptation scheme
  • SAO year your screen adaptation way should upgrade! (2) -smallestWidth qualifier adaptation scheme
  • Toutiao screen adaptation scheme final version officially released!
  • Why is there a problem with AndroidAutoLayout’s design?

Join technical exchange QQ group 455850365

Many people feel that the screen ADAPTS to the frame, that is, the page should be stretched and filled with screen in proportion to the size, height and width of the design, and the layout of the design should be 100% restored.

Isn’t that right?

AndroidAutoLayout such a framework, you can make the device running effect and design exactly the same, is the real percentage screen adaptation framework ah.

And like toutiao screen adaptation scheme and SmallestWidth screen adaptation scheme, which can only be wide or high school as a benchmark for screen adaptation scheme, is obviously not scientific, poor experience scheme ah.

But I can clearly tell you that the above understanding is very one-sided, AndroidAutoLayout such a design is wrong, at least in the current era is wrong.

A design like AndroidAutoLayout works with older devices, but not newer ones, so why is that?

Because AndroidAutoLayout defaults to all devices with the same aspect ratio as the design, it’s safe to stretch the page’s width and height equally to fill the entire screen.

But in an era of full-screen phones, how can there be only a 16:9 aspect ratio? AndroidAutoLayout began to feel uncomfortable.

AndroidAutoLayout’s screen adaptation will have problems as long as the aspect ratio of the phone’s screen is not 16:9, resulting in a badly distorted View.

On any screen, the height and width of the page can fill the screen perfectly, but as long as the device’s aspect ratio is not consistent with the aspect ratio of the design (the aspect ratio of the design is generally 16:9), the View will be severely distorted. See the following figure in 18: On device 9, the square View has become a rectangle.

That said, AndroidAutoLayout’s price for perfectly filling the screen with the height and width of the page on any screen size is to distort the View badly on devices where the aspect ratio of the screen is inconsistent with the aspect ratio of the design.

Even at this cost we can understand how a square design can fill a rectangular screen except at the expense of equal proportions.

But like Toutiao screen adaptation scheme and SmallestWidth screen adaptation scheme, with a wide or high school as a benchmark for screen adaptation scheme, is the perfect screen adaptation scheme?

Also is not.

This solution solves the problem of View distortion on screens with different aspect ratios, but it causes the page height to exceed or fall below the screen height when based on width, and exceed or fall below the screen width when based on height.

Take a look at the image below. On a 18:9 device, the square View remains the same, but the page is 240 px away from the bottom of the screen.

But now most pages will use RecyclerView to display content, so only to ensure that the height or width of a completely consistent with the design, so this problem will be weakened.

At present, no screen adaptation scheme can perfectly solve all problems. AndroidAutoLayout, Toutiao screen adaptation scheme and SmallestWidth screen adaptation scheme all have their own problems. But the problem of AndroidAutoLayout is obviously bigger than toutiao screen adaptation and SmallestWidth screen adaptation. It can’t be stretched proportionally. How can it be called percentage screen adaptation, so this is why I recommend using the latter.

Objective for percentage screen adaptation scheme, not fit effect is the most perfect solution, it is just to help you with the lowest cost to complete the screen adaptation, constantly weighing in the adapter cost and adaptation effect, choose out a compromise of percentage is screen adaptation scheme at the core of concept, if you desperately pursue APP on each device adaptation effect, You’ll have to spend a lot more effort making more detailed screen adaptations for each device.

Don’t ask me again in the future, after using AndroidAutoSize, why there is a gap between the page and the screen, and the effect of the design is not consistent, this question has hurt me to ask, this time I draw the way, you should understand better.

The public,

Search and follow my official account JessYan to learn and progress together. If there is an update to the framework, I will inform you on the official account in the first time


The following is your screen adaptation to upgrade! Series of articles, welcome to forward and share:

  • SAO year your screen adaptation way should upgrade! (I) – Toutiao Adaptation scheme
  • SAO year your screen adaptation way should upgrade! (2) -smallestWidth qualifier adaptation scheme
  • Toutiao screen adaptation scheme final version officially released!
  • Why is there a problem with AndroidAutoLayout’s design?

Hello, my name is JessYan. If you like my articles, you can follow me on the following platforms

  • Personal homepage: Jessyan.me
  • Making: github.com/JessYanCodi…
  • The Denver nuggets: juejin. Cn/user / 976022…
  • Jane: www.jianshu.com/u/1d0c0bc63…
  • Weibo: weibo.com/u/178626251…

— The end