您的位置:首页 > 移动开发 > Android开发

AndroidStudio中的图片资源存放位置以及drawable文件夹的创建方法

2016-12-02 17:43 405 查看
在我们使用AndroidStudio时,项目用到的图片资源存放的位置一直都有分歧,有的说放在drawable下,也有的说放在mipmap下,其实google官方已经给出相关介绍:

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.

也就是说一般将APP的icon放在minmap文件夹下,其他图片资源放在drawable文件夹下。

在创建项目时候,AndroidStudio会自动为我们创建一个drawable文件夹,我们需要创建针对存放不同尺寸的图片的文件夹,接下来我们再来说说AndroidStudio下创建drawable-hdpi、drawable-mdpi、drawable-xhdpi、drawable-xxhdpi的方法。

1.切换到Project视图下,找到对应moudle的res文件夹,然后执行下面步骤,如图所示:







好了,这样就完成了~~~~~~~~~~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  图片 Android
相关文章推荐