qq_25824541 2017-10-29 08:06 采纳率: 80%
浏览 1385
已采纳

关于安卓Bitmap,怎样写一个缩放图片的方法?

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.editnote);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_edit);
setSupportActionBar(toolbar);
EditText editText = (EditText)findViewById(R.id.edit_content);
String imagePath = getIntent().getBundleExtra("neirong").getString(
"nei");
SpannableString ss = new SpannableString(imagePath);
Pattern p=Pattern.compile("/mnt/sdcard/.+?\.\w{3}");
Matcher m=p.matcher(imagePath);
while(m.find()){
Bitmap bm = BitmapFactory.decodeFile(m.group());
Bitmap rbm = resizeImage(bm, 100, 100);
ImageSpan span = new ImageSpan(this, rbm);
ss.setSpan(span, m.start(), m.end(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
editText.setText(ss);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

    InitView();
}
    对应如上代码,resizeImage方法该怎么写?
  • 写回答

3条回答 默认 最新

  • 紫风幻雪 2017-10-30 00:38
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?