android - Skipping disabled EditText's when pressing Next IME button on soft keyboard -
i have linearlayout
several edittext
's, of them created programmatically (not xml layout), , in particular without ids.
when i'm typing in 1 of edittext
's, , next 1 (respective focus) disabled, , press next ime button on keyboard, focus advances disabled edittext
, can't type in it.
what expecting focus advance next enabled edittext
. tried, in addition making edittext
disabled via edittext.setenabled(false)
, disable focusability via edittext.setfocusable(false)
, edittext.setfocusableintouchmode(false)
, , set type_null
input type, no avail.
any hints?
thanks ;)
solved examining how next focusable found keyboard this blog post , 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 focusfinder, invokes addfocusables()
. viewgroup
's implementation tests visibility, while view
implementation tests focusability. neither test enabled state, why added test myedittext
above.
Comments
Post a Comment