다음을 통해 공유


View.OnCreateInputConnection(EditorInfo) Method

Definition

Create a new InputConnection for an InputMethod to interact with the view.

[Android.Runtime.Register("onCreateInputConnection", "(Landroid/view/inputmethod/EditorInfo;)Landroid/view/inputmethod/InputConnection;", "GetOnCreateInputConnection_Landroid_view_inputmethod_EditorInfo_Handler")]
public virtual Android.Views.InputMethods.IInputConnection? OnCreateInputConnection (Android.Views.InputMethods.EditorInfo? outAttrs);
[<Android.Runtime.Register("onCreateInputConnection", "(Landroid/view/inputmethod/EditorInfo;)Landroid/view/inputmethod/InputConnection;", "GetOnCreateInputConnection_Landroid_view_inputmethod_EditorInfo_Handler")>]
abstract member OnCreateInputConnection : Android.Views.InputMethods.EditorInfo -> Android.Views.InputMethods.IInputConnection
override this.OnCreateInputConnection : Android.Views.InputMethods.EditorInfo -> Android.Views.InputMethods.IInputConnection

Parameters

outAttrs
EditorInfo

Fill in with attribute information about the connection.

Returns

Attributes

Remarks

Create a new InputConnection for an InputMethod to interact with the view. The default implementation returns null, since it doesn't support input methods. You can override this to implement such support. This is only needed for views that take focus and text input.

When implementing this, you probably also want to implement #onCheckIsTextEditor() to indicate you will return a non-null InputConnection.

Also, take good care to fill in the android.view.inputmethod.EditorInfo object correctly and in its entirety, so that the connected IME can rely on its values. For example, android.view.inputmethod.EditorInfo#initialSelStart and android.view.inputmethod.EditorInfo#initialSelEnd members must be filled in with the correct cursor position for IMEs to work correctly with your application.

Java documentation for android.view.View.onCreateInputConnection(android.view.inputmethod.EditorInfo).

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