android autosize原理,GitHub - 18252580292/AndroidAutoSize: A low-cost Android screen adaptation soluti...

f042763e2819100f56ceb4162cd9fa5a.png

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4a63656e7465722d76302e372e302d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265

68747470733a2f2f7472617669732d63692e6f72672f4a65737359616e436f64696e672f416e64726f69644175746f53697a652e7376673f6272616e63683d6d6173746572

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4150492d31342532422d626c75652e7376673f7374796c653d666c61742d737175617265

687474703a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d417061636865253230322e302d626c75652e7376673f7374796c653d666c61742d737175617265

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f417574686f722d4a65737359616e2d6f72616e67652e7376673f7374796c653d666c61742d737175617265

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5151e7bea42d3330313733333237382d6f72616e67652e7376673f7374796c653d666c61742d737175617265

A low-cost Android screen adaptation solution (今日头条屏幕适配方案终极版,一个极低成本的 Android 屏幕适配方案).

Overview

Pixel 2 XL | 1440 x 2880 | 560dpi:

25e444a31e4f49bfe1df2cf748e7ac7a.png

7a2e6e3664913ee81c570d1240d98a86.png

1440x2880_external.png

Pixel XL | 1440 x 2560 | 560dpi:

87221a5f0956230930aff6911a4ef0e9.png

3f8d0c316252cba877ac94375d412cd7.png

366e3ac1cfbc6282c35c6dbadd7e0d37.png

Nexus 5X | 1080 x 1920 | 420dpi:

e4f77343ad27580f63d477003bab6cf0.png

0714964660a11807535d46a5220eb138.png

6a2901b4711e62abfc5b5af4137f2dcd.png

Nexus 4 | 768 x 1280 | 320dpi:

1b11fbcab312c783571946886a1f8fc6.png

768x1280_height.png

f0b9835bbb0734df261e9afa1ab03589.png

Nexus S | 480 x 800 | 240dpi:

480x800_width.png

480x800_height.png

6348fa766ed46bfbcc0a0a4a3c11fd56.png

Notice

Download

implementation 'me.jessyan:autosize:0.7.0'

Usage (just one steps)

Step 1

Initialize in AndroidManifest:

android:name="design_width_in_dp"

android:value="360"/>

android:name="design_height_in_dp"

android:value="640"/>

Advance (see demo)

Customize the adaptation parameters of the Activity:

public class CustomAdaptActivity extends AppCompatActivity implements CustomAdapt {

@Override

public boolean isBaseOnWidth() {

return false;

}

@Override

public float getSizeInDp() {

return 667;

}

}

Cancel the adaptation of the Activity:

public class CancelAdaptActivity extends AppCompatActivity implements CancelAdapt {

}

ProGuard

-keep class me.jessyan.autosize.** { *; }

-keep interface me.jessyan.autosize.** { *; }

Donate

pay_alipay.jpgpay_wxpay.jpg

About Me

License

Copyright 2018, jessyan

Licensed under the Apache License, Version 2.0 (the "License");

you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值