Android Studio Drawable和Mipmap文件夹的区别

楼主使用Android studio开发android 应用,最近发现项目工程目录下有Drawable和Mipmap文件夹,今天在谷歌官网找到了两者的区别
 
原生图片放在mipmap 里面 drawable主要放一些放一些自定义形状和按钮变色之类的xml。
google强烈建议使用mipmap装图片。把图片放到mipmaps可以提高系统渲染图片的速度,提高图片质量,减少GPU压力。

drawable/

For bitmap files (PNG, JPEG, or GIF), 9-Patch image files, and XML files that describe Drawable shapes or Drawable objects that contain multiple states (normal, pressed, or focused). See the Drawable resource type.

mipmap/

For app launcher icons. The Android system retains the resources in this folder (and density-specific folders such as mipmap-xxxhdpi) regardless of the screen resolution of the device where your app is installed. This behavior allows launcher apps to pick the best resolution icon for your app to display on the home screen. For more information about using the mipmap folders, see Managing Launcher Icons as mipmap Resources.

Android开发drawablemipmap都是用来存放图片资源的文件夹。它们之间的区别在于使用场景和资源加载的方式。Drawable文件夹适用于存放普通的图片资源,而Mipmap文件夹则适用于存放应用图标等需要在不同分辨率下进行缩放的图片资源。 要将drawable的图片转换为mipmap的图片,你可以按照以下步骤进行操作: 1. 首先,将你想要转换的图片复制到mipmap文件夹。你可以在Android Studio的项目视图找到mipmap文件夹,然后右键点击它,选择"Show in Explorer"(或者"Show in Finder"),在弹出的文件浏览器找到对应的分辨率文件夹。 2. 打开drawable文件夹mipmap文件夹对应的分辨率文件夹,将drawable文件夹的图片复制到mipmap文件夹。 3. 确保复制的图片在mipmap文件夹的分辨率文件夹有相同的文件名。 这样,你就成功地将drawable的图片转换为mipmap的图片了。在代码使用这些图片时,可以直接使用R.mipmap来引用它们。 需要注意的是,mipmap文件夹的图片会根据设备的分辨率自动选择最适合的图片进行显示,这样可以提高应用的性能和效果。而drawable文件夹的图片则不会进行自动缩放处理。 希望这个回答对你有帮助!\[1\]\[3\] #### 引用[.reference_title] - *1* [Androiddrawablemipmap文件夹存放图片的区别(详细解释)](https://blog.csdn.net/wq6ylg08/article/details/114543624)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Androiddrawablemipmap存放图片的区别](https://blog.csdn.net/wzj_what_why_how/article/details/115252487)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [Androiddrawablemipmap到底有什么区别](https://blog.csdn.net/Android23333/article/details/128654278)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值