2013-03-04 7 views
6

私は画面からキーボードを削除するイベントをキャッチしようとしており、私はOnEditorActionListenerクラスを使用しています。しかし、そのonEditorActionメソッドが呼び出されることはありません。Android。 onEditorActionが呼び出されなかった

これはXMLの私のEditTextです:

<EditText 
    android:id="@+id/editTextSearch" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="20dp" 
    android:layout_marginLeft="10dp" 
    android:layout_marginRight="10dp" 
    android:layout_marginTop="50dp" 
    android:layout_weight="0.05" 
    android:background="@color/white" 
    android:ems="10"> 
</EditText> 

これは私がjavaファイルで作業する方法はありません:

private void createTextEdit() 
{ 
    EditText searchTextField = (EditText)findViewById(R.id.editTextSearch); 
    searchTextField.addTextChangedListener(new TextWatcher() 
    { 
     public void afterTextChanged(Editable s) 
     { 
      System.out.println("AFTER TEXT CHANGED");                
     } 
     public void beforeTextChanged(CharSequence s, 
     int start, int count, int after) 
     { 
      System.out.println("BEFORE TEXT CHANGED " + s); 
     } 

     public void onTextChanged(CharSequence s, 
       int start, int before, int count) 
     { 
      System.out.println(s); 
     } 
    }); 

    searchTextField.setOnEditorActionListener(new OnEditorActionListener() 
    { 
     public boolean onEditorAction(TextView v, int actionId, KeyEvent event) 
     { 

      System.out.println("ACTION ID " + actionId);//NEVER CALLED 

      if(actionId == EditorInfo.IME_ACTION_DONE) 
      { 
       System.out.println("ACTION DONE!!!!!!!!!!"); 
       return true; 
      } 

      return false; 
     } 
    }); 

    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 
    imm.showSoftInput(searchTextField, InputMethodManager.SHOW_IMPLICIT); 
} 

どんなに私はsearchTextFieldで何をすべきか、私が編集を開始するか、それを終了するかどうか必要な方法は決して発射されません。何が間違っているのですか?ネクサス7

にここ

答えて

0

同じ問題が、私はそれが無いimeOptionsだったが、思いました。

android:inputType="text"を設定するとタブレットで機能します。

私はそれが他のinputTypeで動作すると仮定します。

Nexusのバグだと思います。

関連する問題