天天看點

Android開發随身筆記

今天在開發app時發現自己項目裡的圖檔放的太過随意了,在mipmap 和drawable 裡都放了許多圖檔,感覺不對勁的我趕緊上官網查了

Android開發随身筆記

下面是引用自 google 官方的描述:

Mipmapping for drawables 

Using a mipmap as the source for your bitmap or drawable is a simple way to provide a quality image and various image scales, which can be particularly useful if you expect your image to be scaled during an animation. 

Android 4.2 (API level 17) added support for mipmaps in the Bitmap class—Android swaps the mip images in your Bitmap when you’ve supplied a mipmap source and have enabled setHasMipMap(). Now in Android 4.3, you can enable mipmaps for a BitmapDrawable object as well, by providing a mipmap asset and setting the android:mipMap attribute in a bitmap resource file or by calling hasMipMap().

一句話總結就是 google 建議大家隻把 app 的啟動圖示放在 mipmap 目錄中,其他圖檔資源仍然放在 drawable 下面。

也就是說一些icon圖示之類的東西可以放在mipmap裡面,其它的還是放在drawable 下面好

繼續閱讀