w446108264 / XhsEmoticonsKeyboard

android emoticonsKeyboard support emoji and user-defined emoticon. easy to integrated into your project
2.85k stars 597 forks source link

发送按钮背景色不支持完全自定义 #41

Closed loganguo closed 8 years ago

loganguo commented 8 years ago

并不像说的那样“组件支持完全自定义,样式支持任意更改”。不知道是我没找到更改的方法还是怎么样,“发送”按钮的背景色没有办法改变。 调用ek_bar.getBtnSend().setBackgroundResource();修改不成功。

w446108264 commented 8 years ago

1.组件支持完全自定义,样式支持任意更改

是指你可以修改任何样式,核心库仅包括https://github.com/w446108264/XhsEmoticonsKeyboard/tree/master/XhsEmoticonsKeyboard/library 其他为示例代码。 该lib主要提供了一套逻辑去解决表情键盘,而非样式。另外附加了一套基本的表情键盘样式,即https://github.com/w446108264/XhsEmoticonsKeyboard/blob/master/XhsEmoticonsKeyboard/library/src/main/java/sj/keyboard/XhsEmoticonsKeyBoard.java

你可以简单修改该样式。如去修改输入栏的样式,或表情背景等,参考 https://github.com/w446108264/XhsEmoticonsKeyboard/blob/master/XhsEmoticonsKeyboard/app/src/main/java/com/xhsemoticonskeyboard/userdef/SimpleUserdefEmoticonsKeyBoard.java

也可以,完全自定义键盘所有样式,参考 https://github.com/w446108264/XhsEmoticonsKeyboard/blob/master/XhsEmoticonsKeyboard/app/src/main/java/com/xhsemoticonskeyboard/qq/QqEmoticonsKeyBoard.java

2.ek_bar.getBtnSend().setBackgroundResource();修改不成功

并非未成功,而是再度被修改了。 https://github.com/w446108264/XhsEmoticonsKeyboard/blob/master/XhsEmoticonsKeyboard/library/src/main/java/sj/keyboard/XhsEmoticonsKeyBoard.java


 mEtChat.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            }

            @Override
            public void afterTextChanged(Editable s) {
                if (!TextUtils.isEmpty(s)) {
                    mBtnSend.setVisibility(VISIBLE);
                    mBtnMultimedia.setVisibility(GONE);
                    mBtnSend.setBackgroundResource(com.keyboard.view.R.drawable.btn_send_bg);
                } else {
                    mBtnMultimedia.setVisibility(VISIBLE);
                    mBtnSend.setVisibility(GONE);
                }
            }
        });

这是低级的错误。下个版本会修复这个问题。

loganguo commented 8 years ago

其实从我的需求来讲,https://github.com/w446108264/XhsEmoticonsKeyboard/blob/master/XhsEmoticonsKeyboard/library/src/main/java/sj/keyboard/XhsEmoticonsKeyBoard.java#L163 这个设置也不符合我自定义的需求。