Android screens more and more as people demand for big-screen handsets
AutoLayout the previous framework for simply adapting screen pixels has a serious problem of distortion
Hongyang's AutoLayout project address has been discontinued.
Https://github.com/hongyangAndroid/AndroidAutoLayout
The following is a width-height ratio thumbnail
Distortion effect left for normal demand right for a full screen
Solution Modify Autolayoutconfig Init method
Match height to width only (AutoLayout inside meta configuration is 1080*1920 16:9 full screen to 18:9)
Source:
public void init (context context) {
getmetadata;
int[] ScreenSize = screenutils.getscreensize (context, usedevicesize);
Mscreenwidth = screensize[0];
Mscreenheight = screensize[1];
}
Modify to the following code
public void init (context context) {
getmetadata;
int[] ScreenSize = screenutils.getscreensize (context, usedevicesize);
Mscreenwidth = screensize[0];
Take the width as the datum
float mdesignrate = 1.0f * mdesignheight/mdesignwidth;
float screenrate = 1.0f * screensize[1]/screensize[0];
if (Screenrate > Mdesignrate) {
mscreenheight = (int) (screensize[1] * (mdesignrate/screenrate));
} else {
mscreenheight = screensize[1];
}
This scheme is not very good, sacrificing the AutoLayout of the percentage layout of the features, just relative to solve the problem of distortion, if there is a better solution can mailbox I
275518834@qq.com