Emoji View,emojiview

來源:互聯網
上載者:User

Emoji View,emojiview

XGG Blog

https://github.com/CyberZHG/EmojiView

This is an Android library which supports inputting and displaying emoji characters.

Introduction

EmojiView supports the entering and displaying of 845 emoji characters in five categories. EmojiView is used for selecting emoji characters in one specific category, while EmojiViewEx is used for selecteding emoji characters for all categories. EmojiEditText and EmojiTextView are extensions of EditText and TextView in Android respectively, which support the displaying of emoji.

There is also a demo in the repository.

Features
  • There are 845 emoji characters.
  • EmojiView: used for selecting and entering emoji characters in specified one category.
  • EmojiViewEx: used for selecting and entering emoji characters in all category.
  • EmojiEditView & EmojiTextView: used for editing and showing texts with emoji respectively.
    (Native EditView and TextView could also be used for showing emoji characters.)
  • Emoji characters are encoded in corresponding Unicode.
  • A lighter library contains only people category.
EmojiView

  • The process of resources loading is lazy.
  • The number of rows and columns could be customized.
  • Navigator dots on the bottom and the color could be customized.
EmojiViewEx

  • Customize border color and the height of category tab.
InstructionImport library

Layout file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    xmlns:emoji="http://schemas.android.com/apk/res/zhaohg.emojiviewdemo"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical"    android:layout_gravity="fill">    <zhaohg.emojiview.EmojiEditText        android:id="@+id/emojiEditText"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:ems="10" >        <requestFocus />    </zhaohg.emojiview.EmojiEditText>    <zhaohg.emojiview.EmojiViewEx        android:id="@+id/emojiView"        android:layout_width="match_parent"        android:layout_height="190dp"        android:background="#EEEEEE"        emoji:indicatorDotsColor="#222222"        emoji:categoryHeight="40dp"/></LinearLayout>
Set EditText
EditText editText = (EditText) this.findViewById(R.id.emojiEditText);EmojiView emojiView = (EmojiViewEx) this.findViewById(R.id.emojiView);emojiView.setEditText(editText);
Use Native EditText and TextView

For EditText overload the onTextChanged method:

@Overrideprotected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {    this.setupEmoji(start, lengthAfter);}private void setupEmoji(int start, int length) {    EmojiSetup.setupEmoji(this.getContext(), this.getText(), (int)this.getTextSize(), start, length);}

For TextView overload the setText method:

@Overridepublic void setText(CharSequence text, BufferType type) {    SpannableStringBuilder builder = new SpannableStringBuilder(text);    EmojiSetup.setupEmoji(this.getContext(), builder, (int) this.getTextSize());    super.setText(builder, type);}
Acknowledgements
  • http://apps.timwhitlock.info/emoji/tables/unicode
  • http://www.iemoji.com/
  • http://www.emoji-cheat-sheet.com/

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.