android EditText 中加入联系人图片 如同来电通那样,发送短信的界面,在EditText搜索到 联系人的时候,会保存为一张view显示出来,并保存在EditText里面androidUI 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 LinearLayout layout = new LinearLayout(this);TextView tv = new TextView(this); String str = mEditSearch.getText().toString(); tv.setText(str);layout.addView(tv);layout.setBackgroundColor(Color.CYAN); Bitmap bitmap = convertViewToBitmap(layout);imageView.setImageBitmap(bitmap); private void addBitmapToEdit(Bitmap bitmap) { mImageSpan = new ImageSpan(this, bitmap); mSpannableString = new SpannableString("p"); mSpannableString.setSpan(mImageSpan, 0, 1 , Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); mEditSearch.append(mSpannableString); } public static Bitmap convertViewToBitmap(View view){ view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED) , View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); view.buildDrawingCache(); Bitmap bitmap = view.getDrawingCache(); return bitmap; } 又是个水区 csdn真的不行了 android视频通话实现方法,请教!!! gcc -E 在 android 更改应用程序图标无效,求教!100分相赠在线等!! 使用android surfaceview 画图 一个滚动字体怎么实现 listview无法按汉字首字母排序问题 SimpleAdapter与button的问题 android xmpp 即时通信 请教彩信发送问题 如何成为一个工程师?Android方面的 求助,用户注册登录模块,输入字母按注册或登录就闪退? andrid 怎么获取本机发送的http请求 android網頁存取
TextView tv = new TextView(this);
String str = mEditSearch.getText().toString();
tv.setText(str);
layout.addView(tv);
layout.setBackgroundColor(Color.CYAN);
Bitmap bitmap = convertViewToBitmap(layout);
imageView.setImageBitmap(bitmap);
private void addBitmapToEdit(Bitmap bitmap) {
mImageSpan = new ImageSpan(this, bitmap);
mSpannableString = new SpannableString("p");
mSpannableString.setSpan(mImageSpan, 0, 1
, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); mEditSearch.append(mSpannableString);
}
public static Bitmap convertViewToBitmap(View view){
view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
, View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
view.buildDrawingCache();
Bitmap bitmap = view.getDrawingCache();
return bitmap;
}