AndroidStudio中的圖片資源存放位置以及drawable文件夾的創建方法

在我們使用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文件夾,然後執行下面步驟,如圖所示: 
這裏寫圖片描述 
這裏寫圖片描述
這裏寫圖片描述
好了,這樣就完成了~~~~~~~~~~

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章