2

Blackberryで仮想キーボードをプログラムで開いたり閉じたり、強制的に開いたりするにはどうすればよいですか?

調べてみましたが、やり方がわかりませんでした。

また、Blackberry サポート フォーラムで次のようなリンクをいくつか見つけてみました。

http://supportforums.blackberry.com/t5/Java-Development/Blackberry-torch-force-reduced-virtual-keyboard-layout/td-p/618989

しかし、これは役に立ちませんでした。

編集:

editField を定義するために使用しているコードは次のとおりです。

/** Horizontal field manager to hold text field*/
  HorizontalFieldManager hfmBadgeNo = new HorizontalFieldManager(FIELD_HCENTER)
  {
   protected void paintBackground(Graphics graphics) {
    graphics.setColor(Color.DARKGRAY);
    graphics.drawRoundRect(60, 10, Display.getWidth() - (60 * 2), getField(0).getHeight() + 10, 5, 5);

    super.paintBackground(graphics);
   }
  };

  // text field to enter Badge Number, it allows only Numeric Digits
  EditField txtEventNumber = new EditField() {
   public void paint(Graphics graphics) {
    super.paint(graphics);
    int oldColor = Color.GRAY;
    graphics.setBackgroundColor(Color.WHITE);
    graphics.setColor(0x181818);
    Font font = this.getFont().derive(Font.EMBOSSED_EFFECT, 54);
    this.setFont(font);
    graphics.setColor(oldColor);
    super.paint(graphics);
   }
   protected void onFocus(int direction) {
    if (VirtualKeyboard.isSupported())
     // Show keyboard
     getScreen().getVirtualKeyboard().setVisibility(VirtualKeyboard.SHOW);
    this.setCursorPosition(this.getTextLength());
    invalidate();
    super.onFocus(direction);
   };
   protected void onUnfocus() {
    if (VirtualKeyboard.isSupported())
     // Hide keyboard
     getScreen().getVirtualKeyboard().setVisibility(VirtualKeyboard.HIDE_FORCE);
    this.setCursorPosition(this.getTextLength());
    invalidate();
    super.onUnfocus();
   };
  };
  // Allows numeric value
  txtEventNumber.setFilter(TextFilter.get(TextFilter.NUMERIC));
  txtEventNumber.setMargin(10 + 5, 60 + 5, 5, 60 + 5);

  // Add text field to manager
  hfmBadgeNo.add(txtEventNumber);

削減されたキーボードは次のとおりです。

ここに画像の説明を入力

フルキーボードは次のとおりです。

ここに画像の説明を入力

4

1 に答える 1

2

BlackBerry Java ベースのデバイス (BlackBerry OS 7.1 まで) キーボードは、フォーカスのある入力フィールドに有効なTextFilterによって決定されます。フィールド コンストラクターのスタイル引数で指定できる定義済みのフィルターがいくつかあります。または、独自のフィルターを最初から作成するか、既存のフィルターを組み合わせて作成することもできます (いずれもニーズを満たしていない場合)。

于 2013-01-10T14:18:59.227 に答える