Not sure about how changing focus will work w/the soft-keyboard, but
you can set the following as an OnKeyListener for your
AutoCompleteTextView to hide it whenever you want....
@Override public boolean onKey(View v, int keyCode, KeyEvent event) {
// .. or whatever key you want to use to trigger this
if(keyCode==KeyEvent.KEYCODE_ENTER) {
final InputMethodManager mgr =
(InputMethodManager)<YourActivity>.this.getSystemService
(Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(
<YourAutoCompleteTextView>.getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS
);
// indicate that you've handled this event
return true;
}
// allow default handling of this event
return false;
}
On Feb 1, 10:56 am, OldSkoolMark <[email protected]> wrote:
> I've got a activity with one AutoCompleteTextView with associated
> 'doit' and 'clear' Buttons and a read-only TextView that displays the
> result of 'doit'. These results are being partially obscured by the
> QWERTY keyboard. I'm trying unsuccessfully to shift focus from the
> auto complete text view to the clear button (or the read only text
> view) thinking that as soon as the auto complete text view loses
> focus, the keyboard will go away.
>
> So my question is really two questions:
>
> 1) Once I succeed in programmatically arranging for my auto complete
> text view to lose focus, will the keyboard go away?
> 2) Focus is stuck on my auto complete text view. I've setFocusable
> (true) on the clear button and the other read-only text view, and
> called requestFocus() from each (I've tried both). Also setText("") in
> the auto complete view. No love. Can I not set focus to a read-only
> textview or a Button?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en