【问题标题】:svg icons are not showing properly in different screen sizes or dimention androidsvg 图标在不同的屏幕尺寸或尺寸 android 中无法正确显示
【发布时间】:2017-11-15 09:09:16
【问题描述】:

在可绘制文件夹中使用 svg 图标并在值 hdpi、xdhpi、xxhpi、xxxhpi 文件夹中创建 dimen.xml 文件,但 svg 图标在不同尺寸的设备中显示不同,或者 svg 图标的布局有所不同,如 hdpi、xdhpi、xxhpi、 xxxhpi。那么有没有解决这个问题的方法。

SVG 内容

<vector 
  android:height="24dp" 
  android:viewportHeight="96.0" 
  android:viewportWidth="96.0"
  android:width="24dp" 
  xmlns:android="schemas.android.com/apk/res/android">; 
        <path android:fillColor="#00000000" android:pathData="M32.74,87A23.74,23.74 0,1 0,9 63.26,23.74 23.74,0 0,0 32.74,87ZM63.26,87A23.74,23.74 0,1 0,39.52 63.26,23.74 23.74,0 0,0 63.26,87ZM48,56.48A23.74,23.74 0,1 0,24.26 32.74,23.74 23.74,0 0,0 48,56.48Z" 
        android:strokeColor="#141515" 
        android:strokeWidth="4"/> 
  </vector>

【问题讨论】:

  • 您能否编辑问题以进一步说明情况?为什么在不同的可绘制文件夹中使用相同的 VectorDrawable?通常只有一个 VectorDrawable 副本。您的 dimens.xml 与问题有何关系;哪些值受 dimens.xml 影响,它们在哪里使用?
  • 理解你的观点@Lewis,编辑我的问题。

标签: android performance android-layout android-studio svg


【解决方案1】:

这是我们添加 SVG 时的常见错误

确保您正在检查覆盖,如图所示:

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 2013-02-05
    • 1970-01-01
    • 1970-01-01
    • 2015-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-09
    • 1970-01-01
    相关资源
    最近更新 更多