2

モバイルデバイスで実行することをターゲットにしたGWTアプリケーションがあります。input type="tel"新しいHTML5を使用して電話入力を受け入れ、モバイルデバイスに正しいキーボード入力(数値)の入力を求めるプロンプトを表示したいと思います。

GWT TextBoxを使用しようとしていますが、正しい入力タイプでHTMLをレンダリングする方法がわかりません。

これについて何かアイデアはありますか?

前もって感謝します。

4

3 に答える 3

5

簡単な方法

TextBox tel=new TextBox();
tel.getElement().setAttribute("type", "tel");

TextBox email=new TextBox();
email.getElement().setAttribute("type", "email");

TextBox url=new TextBox();
url.getElement().setAttribute("type", "url");
于 2012-07-19T07:08:30.883 に答える
2

カスタムウィジェットを作成します。

package com.example;

import com.google.gwt.dom.client.InputElement;
import com.google.gwt.user.client.ui.TextBoxBase;

public class TelephoneBox extends TextBoxBase {

    public TelephoneBox() {
        super(createTelInput());
    }

    private static native InputElement createTelInput() /*-{
        var input = document.createElement("input");
        input.setAttribute("type", "tel");
        return input;
    }-*/;
}

次に、UiBinderで使用できます。

<ui:UiBinder ... xmlns:my="urn:import:com.example">
...
<my:TelephoneBox/>
于 2013-03-17T13:20:30.553 に答える
0

モバイル デバイス用の GWT であるmgwt ( http://www.m-gwt.com ) には、さまざまな入力 (電話入力も) が多数あります。あなたはそれを見たいと思うかもしれません。

于 2012-07-19T06:09:33.517 に答える