2011-12-04 13 views
0

次のフィールド/ボタンにフォーカスを移動しようとしていますが、動作したくないようです。タブキーが押されたときに下に移動する

@Override 
public boolean dispatchKeyEvent(KeyEvent event) { 
    if (event.getKeyCode() == KeyEvent.KEYCODE_TAB) 
    { 
     //move down here once I figure it out.. 
     mEmailvalue.getNextFocusDownId(); 
     return true; 

     } 
    return super.dispatchKeyEvent(event); 
} 

答えて

2

はこれを試してみてください:ここで私が現在持っているものである

public boolean dispatchKeyEvent(KeyEvent event) { 
    if (event.getKeyCode() == KeyEvent.KEYCODE_TAB && event.getAction()==KeyEvent.ACTION_DOWN) { 
     View currentFocus = getCurrentFocus(); 
     if (currentFocus!=null) { 
      View next = currentFocus.focusSearch(View.FOCUS_DOWN); 
      if (next!=null) { 
       next.requestFocus(); 
      } 
     } 
     return true; 
    } 
    return super.dispatchKeyEvent(event); 
} 
関連する問題