문제

I'm trying to convert an EditText to a AutoCompleteTextView. There is another EditText on the same page. When I had two EditText controls, the keyboard would say "Next" while the entry was going on for the fist one and then say "done" for the second one.

After converting the first EditText to an AutoCompleteTextView, the Next button would not skip down to what used to be the second EditText. After looking around for a solution I found that if I added the following...

android:imeOptions="actionNext"

That would solve my problem and it did cause the cursor to skip down to the EditText BUT now my onKey event does not get executed!!

public boolean onKey(View v, int keyCode, KeyEvent event)

So, the imeOptions solution causes worst behavior. I want the Next key to obviously trigger the onKey event and also migrate the cursor to the EditText field.

Actually, I would be happy for the keyboard to just have a "Done" key on the AutoCompleteTextView because I never liked the "Next" thing anyway. Is there anyway of just doing away with this whold Next metaphor and just having the keyboard always say "Done" for all the entry fields on a page? Thanks, Gary

도움이 되었습니까?

해결책

It looks like onKeyListener works ok as long as imeOptions is not used. If imeOptions is used then onKeyListener no longer works - you need to use OnEditorAction. What a mess.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top