2015-12-25 71 views
0

我想打開數字鍵盤,但在整個佈局中沒有edittext。 到目前爲止,我能夠顯示鍵盤。但我無法將類型更改爲數字鍵盤。不帶編輯文本的開放式數字小鍵盤android

這是現在正在工作的代碼,但我想將鍵盤切換到數字鍵盤。

requestFocus(); 
    handler.postDelayed(new Runnable() { 
     @Override 
     public void run() { 
      inputMethodManager.showSoftInput(context, InputMethodManager.SHOW_IMPLICIT); 
     } 
    }, 300); 

這一切都結束,我請求再集中時,其點擊我要顯示數字鍵盤的視圖。

+0

如果你不waana的EditText和要打開鍵盤,然後在要顯示鍵入的文本.. prgrameticall你可以做到這一點setRawInputType(InputType.TYPE_CLASS_NUMBER); ..或者你可以設置機器人:?的inputType =」手機「 –

+0

我會在內存中顯示用戶和商店號碼的小圓點:) – sector11

+0

您將在那裏顯示點並顯示點使用android:inputType =」password「 –

回答

0

seted backedEditText透明。

  <EditText 
      android:id="@+id/editText" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:inputType="textMultiLine" 
      android:layout_margin="10dp" 
      android:background="@color/transparent"/> 

以編程方式設置輸入類型。

editText.setRawInputType(2);