android studio -- 图片应该放在drawable还是mipmap?

android studio 的图片放置
最近使用android studio做一些简单的开发,最后需要放置图片的时候看一下历来的目录,还是有写迷惑,果断google了一下。

在Eclipse中根据图片的像素大小把,png或.jpg的图片放在drawable文件夹下,如drawable-hdpi,drawable-ldpi,drawable-mdpi,drawable-xhdpi,drawable-xxhdpi.同一张图片放在不同的drawable文件夹下,显示的时候会有所不同。但是在xml中引用的时候是一样的。

Android Studio则不一样,没有这么多的drawable目录了,而只有一个drawable文件夹。只需要把图片放里面就好。尝试过新建drawable-hdpi,drawable-ldpi文件夹,是不能被ide显示的,应该是不支持了吧。

一下是google的文档,链接:http://developer.android.com/tools/projects/index.html#mipmap
图片还是放在drawable文件夹下,mipmap只放launcher icons就好了。

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.
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
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、付费专栏及课程。

余额充值