35

2つのAutocompleTextViewがあり、ユーザーが「次へ」を押した場合は次のビューに切り替え、2番目のAutocompleTextViewで「完了」を押したときに仮想キーボードを非表示にします。これまでのところ、「次へ」/「完了」ボタンは何もしません。残念ながら、この問題に対処するリソースは見つかりませんでした。

助言がありますか?どうも

編集:Androidがバージョン2.3またはそのようなものであったときにこれが尋ねられたことを追加したいだけです。

4

4 に答える 4

96

私はこの問題に遭遇し、AutocompleteTextView の imeOptions を actionNext に設定して修正しました。

例:

<AutoCompleteTextView
    android:id="@+id/dialog_product_name"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:singleLine="true"
    android:completionThreshold="1"
    android:imeOptions="actionNext"
    />
于 2011-12-17T21:41:30.317 に答える
3

「次」の問題に対するこの解決策を見つけました。ソースコードの表示で、次のように記述します

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_ENTER) {
    if (firstAutoComplete.hasFocus()) {
    // sends focus to another field (user pressed "Next")
    otherText.requestFocus();
    return true;
    }
    else if (secondAutoComplete.hasFocus()) {
            // sends focus to another field (user pressed "Next")
    anotherText.requestFocus();
    return true;
    }
}
return false;
}

古い Android http://code.google.com/p/android/issues/detail?id=4208のようです。ここで私の解決策を見つけました: http://groups.google.com/group/android-developers/browse_thread/thread/e53e40bfe255ecaf

于 2011-05-09T16:45:50.957 に答える