Android Support Library 23.2 vector drawables are blurry

前端 未结 2 2014
半阙折子戏
半阙折子戏 2020-12-17 16:32

The latest version of the Android Support Library (23.2) adds support for vector drawables. It appears to do this by rasterizing the vectors on the fly on platforms that don

相关标签:
2条回答
  • 2020-12-17 16:45

    increase android: width, height in your XML.

    <vector xmlns:android="http://schemas.android.com/apk/res/android"
            android:width="24dp"
            android:height="24dp"
    

    After I increased the sizes here the generated png size also increased and the images didn't look blurry anymore.

    0 讨论(0)
  • 2020-12-17 17:05

    the vector is rasterized at 16dp and resized to 128dp

    up to 23.1, Android was creating raster images starting from the provided VectorDrawable. This thing changed in v23.2 of the support library. This behavior happens if you set up correctly your build.gradle .

    If you are using the Gradle Plugin 2.0+, add

    android {  
       defaultConfig {  
         vectorDrawables.useSupportLibrary = true  
        }  
     } 
    

    if you are using 1.5.0

     android {  
       defaultConfig {  
         generatedDensities = []  
      }  
    
      // This is handled for you by the 2.0+ Gradle Plugin  
      aaptOptions {  
        additionalParameters "--no-version-vectors"  
      }  
     } 
    

    after you sync, clean your workspace and build again. You can read more about it here and here

    0 讨论(0)
提交回复
热议问题