Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

进入编辑模式 #223

Open
qidianli opened this issue Apr 20, 2020 · 1 comment
Open

进入编辑模式 #223

qidianli opened this issue Apr 20, 2020 · 1 comment

Comments

@qidianli
Copy link

1 RichEditor控件,在用户想再次进入编辑的时候如何设置html内容并进行编辑模式
2 图片插入后如何换行
3 图片宽度充满屏幕,高度自适应,这一块代码有没有设置的

@LongLongLongLongLongLongLongLongLong

1.setHtml()
2.第二个问题我也想知道。
3.插入图片的时候压缩图片到屏幕宽度就可以了
public static Bitmap sizeCompress(Bitmap bmp,float getWidthImae) {

    Bitmap scaledBitmap = null;
    if(bmp!=null){
        // 尺寸压缩倍数,值越大,图片尺寸越小
        int w = bmp.getWidth();
        int h = bmp.getHeight();
        float ratio = w/getWidthImae;
        // 压缩Bitmap到对应尺寸
        Bitmap result = Bitmap.createBitmap((int)(w/ratio), (int)(h/ratio), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(result);
        Rect rect = new Rect(0, 0, (int)(w/ratio), (int)(h/ratio));
        canvas.drawBitmap(bmp, null, rect, null);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        // 把压缩后的数据存放到baos中
        result.compress(Bitmap.CompressFormat.JPEG, 100, baos);
        ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray());
        scaledBitmap = BitmapFactory.decodeStream(isBm);

    return scaledBitmap;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants