diff --git a/src/Android/Avalonia.Android/AndroidInputMethod.cs b/src/Android/Avalonia.Android/AndroidInputMethod.cs index 81b1e91285..5293759586 100644 --- a/src/Android/Avalonia.Android/AndroidInputMethod.cs +++ b/src/Android/Avalonia.Android/AndroidInputMethod.cs @@ -19,6 +19,17 @@ namespace Avalonia.Android public bool IsActive { get; } } + enum CustomImeFlags + { + ActionNone = 0x00000001, + ActionGo = 0x00000002, + ActionSearch = 0x00000003, + ActionSend = 0x00000004, + ActionNext = 0x00000005, + ActionDone = 0x00000006, + ActionPrevious = 0x00000007, + } + class AndroidInputMethod : ITextInputMethodImpl, IAndroidInputMethod where TView : View, IInitEditorInfo { @@ -120,6 +131,17 @@ namespace Avalonia.Android if (options.Multiline) outAttrs.InputType |= global::Android.Text.InputTypes.TextFlagMultiLine; + outAttrs.ImeOptions = options.ReturnKeyType switch + { + TextInputReturnKeyType.Return => ImeFlags.NoEnterAction, + TextInputReturnKeyType.Go => (ImeFlags)CustomImeFlags.ActionGo, + TextInputReturnKeyType.Send => (ImeFlags)CustomImeFlags.ActionSend, + TextInputReturnKeyType.Search => (ImeFlags)CustomImeFlags.ActionSearch, + TextInputReturnKeyType.Next => (ImeFlags)CustomImeFlags.ActionNext, + TextInputReturnKeyType.Previous => (ImeFlags)CustomImeFlags.ActionPrevious, + _ => (ImeFlags)CustomImeFlags.ActionDone + }; + outAttrs.ImeOptions |= ImeFlags.NoFullscreen | ImeFlags.NoExtractUi; return _inputConnection;