/EmotionKeyBoard

Android带表情输入框,支持图片表情、文字表情、emoji

Primary LanguageJava

EmotionKeyBoard

Android 带表情评论框,支持emoji,图片,自定义菜单view,根据软键盘高度自动调整

软件截图

image image image image image

使用说名

布局以SmileyInputRoot为主布局

<?xml version="1.0" encoding="utf-8"?>
<me.yngluo.emotionkeyboard.emotioninput.SmileyInputRoot xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:orientation="vertical">

    <... your view 设置weight=1/>

    <include layout="@layout/my_input_bar" />

</me.yngluo.emotionkeyboard.emotioninput.SmileyInputRoot>

Activity设置相关点击事件

SmileyInputRoot rootViewGroup = (SmileyInputRoot) findViewById(R.id.root);
mPanelRoot = rootViewGroup.getmPanelLayout();

KeyboardUtil.attach(this, mPanelRoot, new KeyboardUtil.OnKeyboardShowingListener() {
    @Override
    public void onKeyboardShowing(boolean isShowing) {
        //键盘状态改变回掉
        Log.e("key board", String.valueOf(isShowing));
    }
});

mPanelRoot.init(input, smileyBtn, btnSend);

[可选]设置菜单view,传入自定义view如my_smiley_menu

mPanelRoot.setMoreView(LayoutInflater.from(this).inflate(R.layout.my_smiley_menu, null), btnMore);

自定义表情 修改array.xml按照格式添加你的表情,表情文件放在asserts/smiley目录,再修改SmileyView文件如下例

List<SmileyDataSet> smileys = new ArrayList<>();
SmileyDataSet setTieba = SmileyDataSet.getDataSet(context, "贴吧", true, R.array.smiley_tieba);
SmileyDataSet setAcn = SmileyDataSet.getDataSet(context, "ac娘", true, R.array.smiley_acn);
SmileyDataSet setJgz = SmileyDataSet.getDataSet(context, "金馆长", true, R.array.smiley_jgz);
SmileyDataSet setYwz = SmileyDataSet.getDataSet(context, "颜文字", false, R.array.smiley_ywz);

smileys.add(setTieba);
smileys.add(setAcn);
smileys.add(setJgz);
smileys.add(SmileyEmoji.getEmojis());
smileys.add(setYwz);
setSmileys(smileys);

意见和反馈

参考项目

JKeyboardPanelSwitch