Skipping disabled EditText's when pressing Next IME button on soft keyboard

Solved by examining how the next focusable is found by the keyboard from this blog post and by subclassing EditText:

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.EditText;

public class MyEditText extends EditText {

    public MyEditText(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public MyEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyEditText(Context context) {
        super(context);
    }

    @Override
    public View focusSearch(int direction) {
        View v = super.focusSearch(direction);
        if (v != null) {
            if (v.isEnabled()) {
                return v;
            } else {
                // keep searching
                return v.focusSearch(direction);
            }
        }
        return v;
    }

}

More details:

ViewGroup implementation of focusSearch() uses a FocusFinder, which invokes addFocusables(). The ViewGroup's implementation tests for visibility, while the View implementation tests for focusability. Neither test for the enabled state, which is why I added this test to MyEditText above.


I solved it setting the focusable property to false, not only the enabled property:

editText.setEnabled(false);
editText.setFocusable(false);