【问题标题】:mgwt: get ios look and feelmgwt:获取 ios 外观
【发布时间】:2015-12-18 11:06:42
【问题描述】:

我正在使用 gwt phonegap 创建一个 phonegap 应用程序。如何创建 iPhone 外观和感觉?

现在,我的 gwt.xml 文件已输入:

<inherits name="com.googlecode.mgwt.ui.client.theme.platform.Platform" />

我正在使用 Phonegap-Emulator 测试应用程序。尽管功能按预期工作,但该应用程序没有 iPhone 外观。

我需要使用某些小部件来获得它吗?

【问题讨论】:

    标签: cordova gwt mgwt


    【解决方案1】:

    首先,我建议您编辑标题,因为这是一个与 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。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多