圖片:大小是144x144胳施,PNG格式
手機:density分別為3.0和2.0的??
步驟,這張圖片分辨放在xxhdpi-drawable捞附,xhdpi-drawable巾乳,hdpi-drawable中
在兩款手機上運行。
獲取到圖片真實的寬高鸟召。
結(jié)論:density高的機器上加載低density文件夾中的圖片比加載對應(yīng)資源文件夾中的圖片會耗費更多的內(nèi)存資源胆绊。
反之就會耗費較少的內(nèi)存資源
(布局文件中的圖片大小都是wrap_content)
實驗日志:
xxhdpi-drawable
screen? 1776? 1080
screen density? 3.0
screen densityDpi? 480
imageview height width? 144? 144
xxhdpi-drawable
screen? 1920? 1080
screen density? 3.0
screen densityDpi? 480
imageview height width? 144? 144
xhdpi-drawable
screen? 1920? 1080
screen density? 3.0
screen densityDpi? 480
imageview height width? 216? 216
xhdpi-drawable
screen? 1184? 720
screen density? 2.0
screen densityDpi? 320
imageview height width? 144? 144
hdpi-drawable
screen? 1184? 720
screen density? 2.0
screen densityDpi? 320
imageview height width? 192? 192
hdpi-drawable
screen? 1776? 1080
screen density? 3.0
screen densityDpi? 480
imageview height width? 288? 288
xxhdpi-drawable
screen? 1184? 720
screen density? 2.0
screen densityDpi? 320
imageview height? 96? 96