我想顯示軟鍵盤,但它不起作用。 這裏是我的代碼:Android:在自定義edittext中觸發softkeaboard
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
myTextView myTextView = new myTextView(this);
setContentView(myTextView);
}
public class myTextView extends EditText{
public boolean onTouchEvent(){
if(action == ACTION_DOWN){
super.onTouchEvent(event);
} }
當我觸摸屏幕時,softkeyboard沒有出現,但出現alertDialog「編輯文本」,這對正常edittexts出現,當你長時間觸摸它們。 在OnCreate這種額外的代碼有沒有感情:
InputMethodManager input = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
input.showSoftInput(myTextView, 0);
感謝您的幫助, Fr4gg0r