您当前的位置: 首页 > 

一个能识别@xxxx 标志从而整块选择与删除的输入框控件。

发布时间:2016-10-18 15:10:58 ,浏览量:0

MentionEditText
项目地址: luckyandyzhang/MentionEditText
简介:一个能识别@xxxx 标志从而整块选择与删除的输入框控件。

MentionEditText adds some useful features for mention string(@xxxx), such as highlight, intelligent deletion, intelligent selection and '@' input detection, etc.

Usage

Insert the following dependency to build.gradle file of your project.

repositories {
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.github.luckyandyzhang:MentionEditText:1.0.0'
}

Use MentionEditText like a normal EditText:


			

In Java code:

MentionEditText editText = ((MentionEditText) findViewById(R.id.editText));
ListmentionList = editText.getMentionList(true); //get a list of mention string
editText.setMentionTextColor(Color.RED); //optional, set highlight color of mention string
editText.setPattern("@[\\u4e00-\\u9fa5\\w\\-]+"); //optional, set regularExpression
editText.setOnMentionInputListener(new MentionEditText.OnMentionInputListener() {
    @Override
    public void onMentionCharacterInput() {
        //call when '@' character is inserted into EditText
    }
});
关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    111321博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.1100s