0

現在、パーセンテージを使用して Android アプリの UI を維持していますが、これは最善の解決策ではないと思います。

ドキュメントでこれを見つけました:

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 または dip に設定した場合、幅 320 px (dip) の座標グリッドが必要であることを意味するはずです...しかし、アプリを起動すると、ウィンドウとビューの幅は 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
4

1 に答える 1