Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/188.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 按下tab键时向下移动_Android_Android 2.2 Froyo - Fatal编程技术网

Android 按下tab键时向下移动

Android 按下tab键时向下移动,android,android-2.2-froyo,Android,Android 2.2 Froyo,我试图将焦点移到下一个字段/按钮,但它似乎不起作用。以下是我目前拥有的: @Override public boolean dispatchKeyEvent(KeyEvent event) { if (event.getKeyCode() == KeyEvent.KEYCODE_TAB) { //move down here once I figure it out.. mEmailvalue.getNextFocusDownId(

我试图将焦点移到下一个字段/按钮,但它似乎不起作用。以下是我目前拥有的:

    @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);
}
试试这个:

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);
}