这是我的代码:
<android.support.design.widget.TextInputLayout
android:id="@+id/mylayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/some_layout">
<android.support.design.widget.TextInputEditText
android:id="@+id/myid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:hint="@string/some_hint"
android:imeOptions="actionNext"
android:inputType="time"
android:maxLength="@integer/max_input_length"
android:maxLines="1"
android:singleLine="true"
android:textSize="15sp"/>
</android.support.design.widget.TextInputLayout>
和Java代码:
myField = (TextInputEditText) findViewById(R.id.myid);
myField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_NEXT) {
Log.d(TAG,"next");
//Do something
handled = true;
}
Log.d(TAG,"handled: "+handled);
return handled;
}
});`
不幸的是,当我按下键盘上的下一个按钮时,什么也没有发生。光标不会跳转到下一个字段。我看不到我错过了什么