首先,我建议您编辑标题,因为这是一个与 gwtphonegap 无关的 mgwt 问题。
当您说您使用“Phonegap-Emulator”时,我假设您的意思是 Ripple,而不是 iOS 模拟器(cordova emulate ios 将使用它)
在Platform.gwt.xml中,操作系统是通过用户代理确定的:
<define-property name="mgwt.os" values="android, ios" />
<property-provider name="mgwt.os"><![CDATA[
// Detect mgwt.os from user agent.
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("iphone") != -1 || ua.indexOf("ipod") != -1) {
// iphone and ipod.
return "ios";
} else if (ua.indexOf("ipad") != -1) {
// ipad.
return "ios";
} else if (ua.indexOf("android") != -1) {
return "android";
}
return "ios";
]]></property-provider>
然后使用mgwt.os 属性来确定小部件的正确外观,例如在Button.gwt.xml 中:
<replace-with class="com.googlecode.mgwt.ui.client.theme.platform.button.ButtonIOSAppearance">
<when-type-is class="com.googlecode.mgwt.ui.client.widget.button.ButtonAppearance" />
<when-property-is name="mgwt.os" value="ios" />
</replace-with>
要回答您的问题,请确保您的模拟器中的用户代理包含字符串“iphone”或“ios”,或者,只需通过添加将 OS 属性设置为 iOS
<set-property name="mgwt.os" value="ios" />
到您的 gwt.xml。