【问题标题】:Codenameone - TextField & KeyboardCodenameone - 文本字段和键盘
【发布时间】:2017-11-07 12:56:08
【问题描述】:

我的 TextField 在获取用户输入时遇到问题。我遵循了可用的示例(开发人员指南、stackoverflow 等),但不知何故键盘没有出现。附上代码(我为了拍摄目的删除了其余代码)和屏幕截图。

需要有关如何使虚拟键盘出现的帮助。

提前TQ。

import com.codename1.ui.Form;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.Resources;
import com.codename1.ui.Toolbar;
import com.codename1.io.Log;
import com.codename1.ui.TextField;
import com.codename1.ui.layouts.BorderLayout;
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 celebriesta {

private Form current;
private Resources theme;
private Form home, allEvent, specEvent, picEvent;


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;
  }

        home = new Form("Home", BoxLayout.y());
        home.setScrollableY(true);

        TextField txt = new TextField();
        txt.setFocusable(true);
        txt.setConstraint(TextField.NUMERIC);
        txt.startEditingAsync();

        home.addComponent(txt); 
        home.show();
 }


public void stop() {
    current = getCurrentForm();
}

public void destroy() {
}


}

【问题讨论】:

    标签: codenameone


    【解决方案1】:

    键盘没有出现在模拟器中。只需使用计算机键盘在文本字段中输入即可。

    在设备上运行时,本机操作系统虚拟键盘将按预期显示。

    【讨论】:

      猜你喜欢
      • 2016-12-28
      • 2017-01-30
      • 2021-09-02
      • 1970-01-01
      • 2012-07-25
      • 2021-06-18
      • 2021-03-26
      • 2014-03-18
      • 2011-01-19
      相关资源
      最近更新 更多