Giter Club home page Giter Club logo

Comments (4)

JessYanCoding avatar JessYanCoding commented on July 18, 2024

1.第一个问题使用框架的 ScreenUtils#getStatusBarHeight() 获取状态栏的高度

2.第二个问题,问的我挺无语的,不管是框架中的注释,还是文章原理,我从来没有提到过,px 可以用来做适配,你有在认真看我的文章吗,这个框架和 AndroidAutoLayout 一滴点关系都没,字体想适配,你用 sp、还是 dp 都可以,想用 px 适配在这个方案上不可能实现

from androidautosize.

wcnmtx avatar wcnmtx commented on July 18, 2024

非常感谢,解决了空隙问题。有仔细阅读,第二问题因为也是没有看到适配字体说明,所以顺带问问。老哥稳。

from androidautosize.

JessYanCoding avatar JessYanCoding commented on July 18, 2024

还有更稳的,AndroidAutoSize 已经把今日头条这方案做到极致,更新到 v0.9.1 版本,在项目布局中可以支持五种单位 (dp、sp、pt、in、mm),以下单位全部支持,使用后面的三个冷门单位,就可以避免修改 density 导致的其他三方库控件以及系统控件的显示异常,还可以直接填写设计图的像素,不需要在转化为 dp

public static float applyDimension(int unit, float value,
                                       DisplayMetrics metrics)
    {
        switch (unit) {
        case COMPLEX_UNIT_PX:
            return value;
        case COMPLEX_UNIT_DIP:
            return value * metrics.density;
        case COMPLEX_UNIT_SP:
            return value * metrics.scaledDensity;
        case COMPLEX_UNIT_PT:
            return value * metrics.xdpi * (1.0f/72);
        case COMPLEX_UNIT_IN:
            return value * metrics.xdpi;
        case COMPLEX_UNIT_MM:
            return value * metrics.xdpi * (1.0f/25.4f);
        }
        return 0;
    }

from androidautosize.

wcnmtx avatar wcnmtx commented on July 18, 2024

哈哈。我已经上车了。

from androidautosize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.