Giter VIP home page Giter VIP logo

android-emotioninputdetector's People

Contributors

dss886 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-emotioninputdetector's Issues

the background will be stretched

if you add a background in the main layout xml file, when the soft keyboard show up the background pic will be stretched. Every haven't be changed only add a background.

表情和文字一行的时候行高会变高

SpanStringUtils

public static SpannableString getEmotionContent(int emotion_map_type,final Context context, final TextView tv, String source) {
SpannableString spannableString = new SpannableString(source);
Resources res = context.getResources();

	String regexEmotion = "\\[([\u4e00-\u9fa5\\w])+\\]";
	Pattern patternEmotion = Pattern.compile(regexEmotion);
	Matcher matcherEmotion = patternEmotion.matcher(spannableString);

	while (matcherEmotion.find()) {
		// 获取匹配到的具体字符
		String key = matcherEmotion.group();
		// 匹配字符串的开始位置
		int start = matcherEmotion.start();
		// 利用表情名字获取到对应的图片
		Integer imgRes = EmotionUtils.getImgByName(emotion_map_type,key);
		if (imgRes != null) {
			// 压缩表情图片
			int size = (int) tv.getTextSize()*13/10;
			Bitmap bitmap = BitmapFactory.decodeResource(res, imgRes);
			Bitmap scaleBitmap = Bitmap.createScaledBitmap(bitmap, size, size, true);

			ImageSpan span = new ImageSpan(context, scaleBitmap);
			spannableString.setSpan(span, start, start + key.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
		}
	}
	return spannableString;
}

spannableString添加imageSpan的时候如果一行里边同时出现表情和文字的话就会出现行高变高的问题,纯文字 纯表情都不会,请问有没有好的解决方案。

进入界面不谈软键盘

EmotionKeyboard.java
public EmotionKeyboard build(){
//设置软件盘的模式:SOFT_INPUT_ADJUST_RESIZE 这个属性表示Activity的主窗口总是会被调整大小,从而保证软键盘显示空间。
//从而方便我们计算软件盘的高度
mActivity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN |
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
//隐藏软件盘
showSoftInput();
return this;
}
EmotionKeyboard这个类的build方法里我设置软键盘弹出不管用,而且我在activity里直接强制弹出软键盘也会弹出一下就又隐藏了。麻烦看一下

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.