-
添加多密度矢量图形(SVG)
android {
...
defaultConfig {
...
// 指定语言资源
resConfigs "zh-rCN", "en"
}
...
buildTypes {
release {
// 压缩资源
shrinkResources true
// 压缩代码
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
android {
...
defaultConfig {
...
// 指定ABI
ndk {
abiFilters 'armeabi-v7a'
}
}
}
-
将图像转换为WebP
Android Studio可以将PNG,JPG,BMP或静态GIF图像转换为WebP格式。
图1.将图像转换为WebP对话框
图2.将JPG转换为WebP格式,质量为75%
图3.将JPG转换为0%质量的WebP格式
注意:
1.9-Patch文件无法转换为WebP图像。转换器工具始终会自动跳过9-Patch图像。
2.如果将质量设置为100%并且minSdkVersion设置为18或更高,则Android Studio会自动切换到无损编码。