2017-11-24 15 views

答えて

1

これはあなたが試すことができるものです。

editText.setOnEditorActionListener(new TextView.OnEditorActionListener() { 
     @Override 
     public boolean onEditorAction(final TextView textView, final int i, final KeyEvent keyEvent) { 
      if (i== EditorInfo.IME_ACTION_NEXT){ 
       editText.clearFocus(); 
       button.requestFocus(); 
      } 
      return false; 
     } 
    }); 
    button.setOnFocusChangeListener(new View.OnFocusChangeListener() { 
     @Override 
     public void onFocusChange(final View view, final boolean b) { 
      if (view.isFocused()){ 
       button.setBackgroundResource(R.color.colorAccent); 
      } 
     } 
    }); 
+0

xmlのアンドロイドサポートの設定はありますか? –

+0

あなたはnextfocusdownを持つことができますが、それはボタンでは機能しません。そして、あなたはjavaコードだけを使ってそれを取得しなければなりません。 –

+0

私は2つのEditTextとボタンを持っています。 2番目のEditTextでコードを実装しましたが、UIはButtonにフォーカスしません。最初のEditText –

関連する問題