共用方式為


IInputConnection.CommitCompletion(CompletionInfo) Method

Definition

Commit a completion the user has selected from the possible ones previously reported to InputMethodSession#displayCompletions InputMethodSession#displayCompletions(CompletionInfo[]) or InputMethodManager#displayCompletions InputMethodManager#displayCompletions(View, CompletionInfo[]).

[Android.Runtime.Register("commitCompletion", "(Landroid/view/inputmethod/CompletionInfo;)Z", "GetCommitCompletion_Landroid_view_inputmethod_CompletionInfo_Handler:Android.Views.InputMethods.IInputConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool CommitCompletion (Android.Views.InputMethods.CompletionInfo? text);
[<Android.Runtime.Register("commitCompletion", "(Landroid/view/inputmethod/CompletionInfo;)Z", "GetCommitCompletion_Landroid_view_inputmethod_CompletionInfo_Handler:Android.Views.InputMethods.IInputConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member CommitCompletion : Android.Views.InputMethods.CompletionInfo -> bool

Parameters

text
CompletionInfo

The committed completion.

Returns

true on success, false if the input connection is no longer valid.

Attributes

Remarks

Commit a completion the user has selected from the possible ones previously reported to InputMethodSession#displayCompletions InputMethodSession#displayCompletions(CompletionInfo[]) or InputMethodManager#displayCompletions InputMethodManager#displayCompletions(View, CompletionInfo[]). This will result in the same behavior as if the user had selected the completion from the actual UI. In all other respects, this behaves like #commitText(CharSequence, int).

<strong>IME authors:</strong> please take care to send the same object that you received through android.inputmethodservice.InputMethodService#onDisplayCompletions(CompletionInfo[]).

<strong>Editor authors:</strong> if you never call InputMethodSession#displayCompletions(CompletionInfo[]) or InputMethodManager#displayCompletions(View, CompletionInfo[]) then a well-behaved IME should never call this on your input connection, but be ready to deal with misbehaving IMEs without crashing.

Calling this method (with a valid CompletionInfo object) will cause the editor to call android.inputmethodservice.InputMethodService#onUpdateSelection(int, int, int, int, int, int) on the current IME after the batch input is over. <strong>Editor authors</strong>, for this to happen you need to make the changes known to the input method by calling InputMethodManager#updateSelection(View, int, int, int, int), but be careful to wait until the batch edit is over if one is in progress.

Java documentation for android.view.inputmethod.InputConnection.commitCompletion(android.view.inputmethod.CompletionInfo).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to