6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Android】drawableとmipmapの違い

Posted at

プログラミング勉強日記

2020年12月17日
mipmapとdrawableの違いがいまいちわからなかったので簡単にまとめる。

drawableとmipmapとは

 mipmapは3Dで使われていて、遠くの物体には荒いテクスチャ-で、近くの物体には細かいテクスチャーを使う技術である。
 Androidは3Dではないが、drawableで似たようなことが行われている。端末のピクセルサイズに応じてサイズの異なる画像を用意することで画面密度が荒い端末ではメモリー消費量を節約して、画面密度が細かい端末では高精細な画像を適用する qualifierという仕組みである。

drawableとmipmapの違い

 drableに指定されている画像は端末のピクセルサイズを元にxxhdpiの画像を使用し、mipmapに指定されている画像は描画するときの画面密度を元に適切な画像を切り替えてxxhdpiの画像を使用する。画像では拡大より縮小のほうが画質劣化が少ないことからも、drawableなxxhdpiを拡大するよりmipmapなxxxhdpiを縮小したほうが画質の劣化を抑えることができる。

結論

  • 基本的にアプリアイコンはmipmapだけでいい
  • 画像リソースの場合はdrawable
  • アプリ内で画像の拡大縮小をするときはmipmap

Android4.1以前の場合、アプリアイコンはdrawableとmipmapの両方を使う

参考文献

drawableとmipmapの違い
【Andorid】アプリアイコンは「mipmap-」というリソースディレクトリに入れるのがいいらしい

6
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?