xlarge screens are at least 960dp x 720dp large screens are at least 640dp x 480dp normal screens are at least 470dp x 320dp small screens are at least 426dp x 320dp
它幫我們算出,每個分類 至少 會有多少dp
當然參考值畢竟是參考值,多少會有例外 例外的部分就依照個別機種去調整版面
就我的經驗是
你必須要先考慮各種螢幕大小的版型是否會跑版, 再來考慮圖的畫質問題
怎麼測各種螢幕大小、機種?有幾種方法
儘可能的拿實機測
拿模擬器,指定特定的密度與螢幕大小來模擬
剛建立版型的時候,先固定一種螢幕大小去測試 (例如手上測試機)
然後先利用GenyMotion等模擬器,把所有螢幕大小分類都跑一遍 有問題的話先做修正
再來就是看各機種的問題做測試了
密度的分類
再來是畫質密度的問題,就是文章開頭很頭痛 Density
密度的分類剛剛看過了
ldpi、mdpi、hdpi、xhpi
一樣有low、medium、high、extra high等分別
以mdpi為基準點
3:4:6:8 的比例做縮放
以48px x 48px的圖示來說
ldpi 為 36×36
mdpi 為 48×48 (因為它是基準點嘛)
hdpi 為 72×72
xdpi 為 96×96
以Desire HD來說
(不要再問我為何Desire HD有4.0.3了,因為我有刷機嘛)
以Desire HD來說,像素尺寸為 480×800
分類屬於 normal / hdpi 的螢幕
所以是換算成mdpi的話,將px全部除上1.5倍
480 / 1.5 = 320 800 / 1.5 = 533.33
再回頭查看原有程式的比例
在dp這一欄,剛好就是320×533
官方文件可以清楚看到
ldpi
Resources for low-density (ldpi) screens (~120dpi).
mdpi
Resources for medium-density (mdpi) screens (~160dpi). (This is the baseline density.)
hdpi
Resources for high-density (hdpi) screens (~240dpi).
xhdpi
Resources for extra high-density (xhdpi) screens (~320dpi).
tvdpi
Resources for screens somewhere between mdpi and hdpi; approximately 213dpi. This is not considered a “primary” density group. It is mostly intended for televisions and most apps shouldn’t need it—providing mdpi and hdpi resources is sufficient for most apps and the system will scale them as appropriate. If you find it necessary to provide tvdpi resources, you should size them at a factor of 1.33*mdpi. For example, a 100px x 100px image for mdpi screens should be 133px x 133px for tvdpi.
<?php $conn = mssql_connect($serverName, $DBUsername, $DBPassword) or die("Couldn’t connect to SQL Server on $myServer"); if (!$conn) { die(‘Something went wrong while connecting to MSSQL’); } ?>
error: cannot access com.J_Test.hellondk.MainActivity class file for com.J_Test.hellondk.MainActivity not found javadoc: error – Class com.J_Test.hellondk.MainActivity not found. Error: No classes were specified on the command line. Try -help.