richeditor-android
richeditor-android copied to clipboard
How to change the size of the insert picture?
findViewById(R.id.action_insert_image).setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
mEditor.insertImage("http://file.yirimao.com/1488878219-771243-0.jpg\" style=\"width:100%;", "alt");
String html = mEditor.getHtml();
}
});
i found a way, but a bit @stranger.
edit the style.css under the asset folder, and add code like this:
img { width:80%; }
修改js文件中insertImage方法,添加参数width,height,
var html = '</br><img style="margin:0 auto; width:'+ width +'px;height:' + height+ 'px" src="'+url+'" alt="'+alt+'" /></br>';
可以替换,让它适配屏幕 content = content.replace("<img","<img style="max-width:100%;height:auto"");