2012-03-06 63 views

回答

0

嘗試使用具有樣式類型按鈕的edittext。看到XML下面的代碼

<EditText 
      android:id="@+id/buttonedittext" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"     
      android:text="test" 
      style="@android:style/Widget.Button" /> 

我像顯示按鈕,還當你點擊它顯示軟鍵盤,你可以鍵入任何你想要的。

希望對你有用:)

1
public static void showKeyboard(View view) 

{ 

    InputMethodManager mgr = (InputMethodManager)myContext.getSystemService(Context.INPUT_METHOD_SERVICE); 

    mgr.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); 

    ((InputMethodManager)myContext.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(view, 0); 

} 

此代碼,進入按鈕上的文字是打開softkeyboard。你可以把它放在你的Button的onClick中。但我不確定是否在按鈕上打字。我是第一次遇到這個問題。爲什麼你不使用editText?

+0

根據客戶端要求,需要在button.not中使用編輯文本輸入文本。 – 2012-03-06 07:13:22