Android Studio中的mipmap和drawable

本文详细解释了Android项目中main/res目录下的drawable和mipmap文件夹的作用。介绍这两个文件夹分别用于存放哪些类型的资源文件,并指出它们之间的主要区别,包括支持的文件类型和在不同屏幕分辨率下的表现。
摘要由CSDN通过智能技术生成
翻阅了Android 开发者官网( http://developer.android.com);

找到以下解释:

<code class="hljs livecodeserver has-numbering">main/res/
    Contains application resources, such <span class="hljs-keyword">as</span> drawable <span class="hljs-built_in">files</span>, layout <span class="hljs-built_in">files</span>, <span class="hljs-operator">and</span> <span class="hljs-keyword">string</span> values <span class="hljs-operator">in</span> <span class="hljs-operator">the</span> following <span class="hljs-built_in">directories</span>. 
See Application Resources <span class="hljs-keyword">for</span> more information.

    drawable/
<span style="color:#FF0000;">For bitmap <span class="hljs-built_in">files</span> (PNG, JPEG, <span class="hljs-operator">or</span> GIF), <span class="hljs-number">9</span>-Patch image <span class="hljs-built_in">files</span>, <span class="hljs-operator">and</span> XML <span class="hljs-built_in">files</span> </span>that describe Drawable shapes <span class="hljs-operator">or</span> Drawable objects that 
contain multiple states (<span class="hljs-keyword">normal</span>, pressed, <span class="hljs-operator">or</span> focused). See <span class="hljs-operator">the</span> Drawable resource type.

    mipmap/
<span style="color:#FF0000;">For app launcher icons</span>. The Android <span class="hljs-keyword">system</span> retains <span class="hljs-operator">the</span> resources <span class="hljs-operator">in</span> this <span class="hljs-built_in">folder</span> (<span class="hljs-operator">and</span> density-specific <span class="hljs-built_in">folders</span> such <span class="hljs-keyword">as</span> mipmap-xxxhdpi) 
regardless <span class="hljs-operator">of</span> <span class="hljs-operator">the</span> screen resolution <span class="hljs-operator">of</span> <span class="hljs-operator">the</span> device where your app is installed. This behavior allows launcher apps <span class="hljs-built_in">to</span> pick <span class="hljs-operator">the</span> best resolution 
icon <span class="hljs-keyword">for</span> your app <span class="hljs-built_in">to</span> display <span class="hljs-command"><span class="hljs-keyword">on</span> <span class="hljs-title">the</span> <span class="hljs-title">home</span> <span class="hljs-title">screen</span>. <span class="hljs-title">For</span> <span class="hljs-title">more</span> <span class="hljs-title">information</span> <span class="hljs-title">about</span> <span class="hljs-title">using</span> <span class="hljs-title">the</span> <span class="hljs-title">mipmap</span> <span class="hljs-title">folders</span>, <span class="hljs-title">see</span> <span class="hljs-title">Managing</span> <span class="hljs-title">Launcher</span> <span class="hljs-title">Icons</span> <span class="hljs-title">as</span> <span class="hljs-title">mipmap</span> <span class="hljs-title">Resources</span>.</span></code>


从上边的红色部分能看出drawable下可以是 png,jpeg,gif,9-patch,xml 等文件。

而mipmap则没有明确指出能使用哪种文件。

但是我在使用过程中发现.9图片不能在mipmap中使用,可以在drawable中使用。

另外 还有一个区别就是在图片的缩放上mipmap优化了一些性能。





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值