mgwt:获取 ios 外观和感觉
mgwt: get ios look and feel
我正在使用 gwt phonegap 创建一个 phonegap 应用程序。如何创建 iPhone 外观和感觉?
现在,我在我的 gwt.xml-文件中输入了条目:
<inherits name="com.googlecode.mgwt.ui.client.theme.platform.Platform" />
我正在使用 Phonegap-Emulator 测试应用程序。虽然功能按预期工作,但应用程序没有 iPhone 外观。
我需要使用某些小部件才能获得吗?
首先,我建议您编辑标题,因为这是一个与 gwtphonegap 无关的 mgwt 问题。
当你说你使用 'Phonegap-Emulator' 时,我假设你的意思是 Ripple,而不是 iOS 模拟器(cordova emulate ios
)
在Platform.gwt.xml
中,OS是通过用户代理确定的:
<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.
我正在使用 gwt phonegap 创建一个 phonegap 应用程序。如何创建 iPhone 外观和感觉?
现在,我在我的 gwt.xml-文件中输入了条目:
<inherits name="com.googlecode.mgwt.ui.client.theme.platform.Platform" />
我正在使用 Phonegap-Emulator 测试应用程序。虽然功能按预期工作,但应用程序没有 iPhone 外观。
我需要使用某些小部件才能获得吗?
首先,我建议您编辑标题,因为这是一个与 gwtphonegap 无关的 mgwt 问题。
当你说你使用 'Phonegap-Emulator' 时,我假设你的意思是 Ripple,而不是 iOS 模拟器(cordova emulate ios
)
在Platform.gwt.xml
中,OS是通过用户代理确定的:
<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.