zoukankan      html  css  js  c++  java
  • android 不同dp对资源的处理方式

    http://developer.android.com/training/basics/supporting-devices/screens.html

    Create Different Bitmaps


    You should always provide bitmap resources that are properly scaled to each of the generalized density buckets: low, medium, high and extra-high density. This helps you achieve good graphical quality and performance on all screen densities.

    To generate these images, you should start with your raw resource in vector format and generate the images for each density using the following size scale:

    • xhdpi: 2.0
    • hdpi: 1.5
    • mdpi: 1.0 (baseline)
    • ldpi: 0.75

    This means that if you generate a 200x200 image for xhdpi devices, you should generate the same resource in 150x150 for hdpi, 100x100 for mdpi, and 75x75 for ldpi devices.

    Then, place the files in the appropriate drawable resource directory:

    MyProject/
        res/
            drawable-xhdpi/
                awesomeimage.png
            drawable-hdpi/
                awesomeimage.png
            drawable-mdpi/
                awesomeimage.png
            drawable-ldpi/
                awesomeimage.png
    

    Any time you reference @drawable/awesomeimage, the system selects the appropriate bitmap based on the screen's density.

    Note: Low-density (ldpi) resources aren’t always necessary. When you provide hdpi assets, the system scales them down by one half to properly fit ldpi screens.

    For more tips and guidelines about creating icon assets for your app, see the Iconography design guide.

  • 相关阅读:
    Windows ETW 学习与使用三
    暗云Ⅳ对SATA磁盘MBR Hook探索
    msahci代码调试备份
    mimikatz使用命令记录
    Windows ETW 学习与使用一
    RabbitMQ 实现延迟队列
    Redis 脱坑指南
    浅析 ThreadLocal
    IDEA2020.2.3破解
    用友NC 模块 简写(瞎猜的)
  • 原文地址:https://www.cnblogs.com/kkia/p/3593309.html
Copyright © 2011-2022 走看看