【问题标题】:BrowserComponent doesn't work on CodenameOne 3.7.2?BrowserComponent 在 CodenameOne 3.7.2 上不起作用?
【发布时间】:2017-07-17 18:15:00
【问题描述】:

以下代码在模拟器中不起作用(在 NetBeans 8.2 + CodenameOne 3.7.2 + Skin Iphone3gs 上)并且在我的 Android 4.1.2 设备中不起作用。它会阻止模拟器并在真实设备上显示一个空白屏幕(闪烁的“正在加载...”)。有什么问题?谢谢

import static com.codename1.ui.CN.*;
import com.codename1.ui.Display;
import com.codename1.ui.Form;
import com.codename1.ui.Dialog;
import com.codename1.ui.Label;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.Resources;
import com.codename1.io.Log;
import com.codename1.ui.BrowserComponent;
import com.codename1.ui.Toolbar;
import com.codename1.ui.layouts.BorderLayout;
import java.io.IOException;
import com.codename1.ui.layouts.BoxLayout;

/**
 * This file was generated by <a href="https://www.codenameone.com/">Codename One</a> for the purpose 
 * of building native mobile applications using Java.
 */
public class Gmail {

    private Form current;
    private Resources theme;

    public void init(Object context) {
        theme = UIManager.initFirstTheme("/theme");

        // Enable Toolbar on all Forms by default
        Toolbar.setGlobalToolbar(true);

        // Pro only feature
        Log.bindCrashProtection(true);
    }

    public void start() {
        if(current != null){
            current.show();
            return;
        }
        Form hi = new Form("Form title Example", new BorderLayout());
        BrowserComponent browser = new BrowserComponent();
        browser.setURL("https://students.uninettunouniversity.net/");
        hi.add(BorderLayout.CENTER, browser);
    }

    public void stop() {
        current = getCurrentForm();
        if(current instanceof Dialog) {
            ((Dialog)current).dispose();
            current = getCurrentForm();
        }
    }

    public void destroy() {
    }

}

【问题讨论】:

    标签: codenameone


    【解决方案1】:

    您删除了末尾的hi.show()

    【讨论】:

    • 哦,我的分心!但是,为什么模拟器中的行为与真实设备中的行为不同?在 Android 上,网站(即 Gmail)正常工作并记住我的帐户,在模拟器上,页面不允许我登录。
    • 在桌面上,我们使用我们现有的桌面浏览器。我们无法对设备完全准确地模拟 HTML。
    猜你喜欢
    • 2021-11-18
    • 2014-08-30
    • 2017-09-15
    • 1970-01-01
    • 2014-07-07
    • 1970-01-01
    • 2018-01-04
    • 2020-09-01
    • 1970-01-01
    相关资源
    最近更新 更多