Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

EmojiAppCompatEditText

open class EmojiAppCompatEditText : AppCompatEditText
kotlin.Any
   ↳ android.view.View
   ↳ android.widget.TextView
   ↳ android.widget.EditText
   ↳ androidx.appcompat.widget.AppCompatEditText
   ↳ androidx.emoji.widget.EmojiAppCompatEditText

AppCompatEditText widget enhanced with emoji capability by using EmojiEditTextHelper. When used on devices running API 18 or below, this widget acts as a regular AppCompatEditText. androidx.emoji.R.attr#maxEmojiCount

Summary

Public constructors

<init>(context: Context!)

<init>(context: Context!, attrs: AttributeSet!)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

Public methods

open Int

Returns the maximum number of EmojiSpans to be added to a CharSequence.

open InputConnection!

open Unit
setKeyListener(@Nullable keyListener: KeyListener?)

open Unit
setMaxEmojiCount(maxEmojiCount: Int)

Set the maximum number of EmojiSpans to be added to a CharSequence.

Inherited functions

Public constructors

<init>

EmojiAppCompatEditText(context: Context!)

<init>

EmojiAppCompatEditText(context: Context!, attrs: AttributeSet!)

<init>

EmojiAppCompatEditText(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

Public methods

getMaxEmojiCount

open fun getMaxEmojiCount(): Int

Returns the maximum number of EmojiSpans to be added to a CharSequence.

onCreateInputConnection

open fun onCreateInputConnection(outAttrs: EditorInfo!): InputConnection!

setKeyListener

open fun setKeyListener(@Nullable keyListener: KeyListener?): Unit

setMaxEmojiCount

open fun setMaxEmojiCount(maxEmojiCount: Int): Unit

Set the maximum number of EmojiSpans to be added to a CharSequence. The number of spans in a CharSequence affects the performance of the EditText insert/delete operations. Insert/delete operations slow down as the number of spans increases.

Parameters
maxEmojiCount Int: maximum number of EmojiSpans to be added to a single CharSequence, should be equal or greater than 0