首頁>Program>source

我有 PSD ,分辨率為 1080X1920 ,其中包含一个 Dot 分辨率為 22X22的圖像

我裁剪了该圖像並將其放在我的 res中 檔案夹。

我的問题是Android如何知道该圖像適用於 1080X1920 螢幕.它將在 small中打開较大的同一圖像 螢幕和在 2560x1440中较小 分辨率。

Is there a way other than putting different images for each screen sizes to tell android to use the image for specific screen size and scale for other screens

最新回復
  • 5月前
    1 #

    直接使用https://romannurik.github.io/AndroidAssetStudio/

    For example, two devices that both report a screen size of normal might have actual screen sizes and aspect ratios that are slightly different when measured by hand. Similarly, two devices that report a screen density of hdpi might have real pixel densities that are slightly different. Android makes these differences abstract to applications, so you can provide UI designed for the generalized sizes and densities and let the system handle any final adjustments as necessary

    您必须建立不同的dimen,layout,圖像和圖標檔案以支援所有設備。

    changes in screen density.

    xlarge screens are at least 960dp x 720dp
    large screens are at least 640dp x 480dp
    normal screens are at least 470dp x 320dp
    small screens are at least 426dp x 320dp
    

    Make this layout files, so that it will be same for all devices

    根据設備提供填充,邊距,字型和所有屬性。

    res/layout/main_activity.xml           # For handsets (smaller than 600dp available width)
    res/layout-sw600dp/main_activity.xml   # For 7” tablets (600dp wide and bigger)
    res/layout-sw720dp/main_activity.xml   # For 10” tablets (720dp wide and bigger)
    

    For Layout

    res/layout/my_layout.xml              // layout for normal screen size ("default")
    res/layout-large/my_layout.xml        // layout for large screen size
    res/layout-xlarge/my_layout.xml       // layout for extra-large screen size
    res/layout-xlarge-land/my_layout.xml  // layout for extra-large in landscape orientation
    

    For Images

    res/drawable-mdpi/graphic.png         // bitmap for medium-density
    res/drawable-hdpi/graphic.png         // bitmap for high-density
    res/drawable-xhdpi/graphic.png        // bitmap for extra-high-density
    res/drawable-xxhdpi/graphic.png       // bitmap for extra-extra-high-density
    

    For Icon

    res/mipmap-mdpi/my_icon.png         // launcher icon for medium-density
    res/mipmap-hdpi/my_icon.png         // launcher icon for high-density
    res/mipmap-xhdpi/my_icon.png        // launcher icon for extra-high-density
    res/mipmap-xxhdpi/my_icon.png       // launcher icon for extra-extra-high-density
    res/mipmap-xxxhdpi/my_icon.png      // launcher icon for extra-extra-extra-high-density
    

    For Launcher icon

    36x36 (0.75x) for low-density
    48x48 (1.0x baseline) for medium-density
    72x72 (1.5x) for high-density
    96x96 (2.0x) for extra-high-density
    180x180 (3.0x) for extra-extra-high-density
    192x192 (4.0x) for extra-extra-extra-high-density (launcher icon only; see note above)
    

    結帐尺寸和 支援多屏官方文件。

  • 5月前
    2 #

    Android Studio在您的Android Studio中安裝了一个名為"批處理可绘製"的插件.這有助於建立不同大小的圖像。

    匯入步骤: 檔案->設置->插件->瀏覽儲存庫->單击安裝按钮。

    重新啟動Android Studio,然後您將可以在Android Studio的檔案選單中找到"批處理可绘製"。

    鏈接:https://github.com/winterDroid/android-drawable-importer-intellij-plugin

  • 5月前
    3 #

    將大型圖像放入可绘製檔案夹.

  • 5月前
    4 #

    您無需做其他任何事情,只需將不同分辨率的檔案放入不同的drawable-xxx檔案即可.請記住,所有圖片都必须具有相同的名稱,但是Android不会自動匹配每个圖片的螢幕尺寸,因為檔案名不匹配.祝你好運!

  • html:為什麼隱藏的溢位会阻止浮動元素逃离其容器?
  • ios:Google Plus API,可在Facebook等墙上张贴