0
目前我使用百分比來維護我的Android應用UI,但我認爲這不是最好的解決方案。所有Android設備的一個座標網格(Appcelerator)
我發現這個文檔中:
The coordinates grid
Titanium uses a grid coordinate system for layout. Grid locations are based on the system unit (platform-dependent unit). This means that by default on iOS, elements are positioned on a density-independent grid and on Android on a density-dependent grid. The net result is that on iOS, elements are positioned in visually the same locations regardless of the actual density of the screen. On Android, elements are positioned at the same absolute pixel locations and might lay out differently depending on the device.
iPhone with either original or retina display is based on a 320 x 480 dip grid.
iPad is based on a 1024 x 768 dip grid.
Android device screen sizes vary. Considering these emulator examples:
HVGA emulator is 320 x 480 px
WVGA800 emulator is 480 x 800 px
WVGA854 emulator is 480 x 854 px
Remember that you can specify dp or dip units on Android (and even set an app-level default in tiapp.xml) to achieve the same density-independent grid as offered by default on iOS.
正如我想,這最後一句的意思是,如果我設置tiapp.xml應用級默認爲DP或浸的話,我應該有一個座標網格與320像素(dip)寬度...但是當我啓動我的應用程序,Windows和視圖寬度是360 ...爲什麼?哪裏有問題?
這些是我的設備的一些displayCaps信息。
[INFO] : Ti.Platform.displayCaps.density: xxhigh
[INFO] : Ti.Platform.displayCaps.dpi: 480
[INFO] : Ti.Platform.displayCaps.platformHeight: 1776
[INFO] : Ti.Platform.displayCaps.platformWidth: 1080
[INFO] : Ti.Platform.displayCaps.logicalDensityFactor: 3
[INFO] : Ti.Platform.displayCaps.xdpi: 442.45098876953125
[INFO] : Ti.Platform.displayCaps.ydpi: 443.3450012207031