Igor Strekha
Igor Strekha

Reputation: 194

How to implement only emoji keyboard for Entry?

I would like to implement Custom Entry (Xamarin.forms) when the user focus the Entry, device will show Emoji keyboard.

Upvotes: 3

Views: 1070

Answers (2)

Akash Limbani
Akash Limbani

Reputation: 1351

https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/text/entry#customizing-the-keyboard

Customizing the Keyboard

The keyboard that's presented when users interact with an Entry can be set programmatically via the Keyboard property, to one of the following properties from the Keyboard class:

  • Chat – used for texting and places where emoji are useful.
  • Default – the default keyboard.
  • Email – used when entering email addresses.
  • Numeric – used when entering numbers.
  • Plain – used when entering text, without any KeyboardFlags specified.
  • Telephone – used when entering telephone numbers.
  • Text – used when entering text.
  • Url – used for entering file paths & web addresses.

This can be accomplished in XAML as follows:

<Entry Keyboard="Chat" />

The equivalent C# code is:

var entry = new Entry { Keyboard = Keyboard.Chat };

Upvotes: 0

EvZ
EvZ

Reputation: 12169

Short answer

Unfortunately it is impossible without creating your own keyboard, due to Android and iOS platform limitations.

Long answer

Default behaviour on iOS is to show the emoji keyboard icon in the bottom of the keyboard. So it is only one tap away from the user:

Default behaviour on Android is seems to be slightly different and the emoji keyboard is hidden by default:


Luckily, it is very easy to place the emoji keyboard icon by setting the InputType to Android.Text.InputTypes.TextVariationShortMessage | Android.Text.InputTypes.ClassText:

If you are still looking to show the emoji keyboard by default, I am afraid you will have to implement your own keyboard view. Depend on your needs you could add few emojis as buttons and etc.

Upvotes: 1

Related Questions