后台是用的FCKeditor上传的商品详情,保存为html 格式 。因为在网站上也要显示,图片的尺寸较大,在手机上图片显示不下,怎么破?有没有好的意见?首次在CSDN提问,不懂行事。。请多包涵手机fckeditor

解决方案 »

  1.   

    你如果向在android客户端展现图片,却因为图片的尺寸过大,你可以截取图片的尺寸
      

  2.   


       protected Bitmap scaleImg(Bitmap bm, int newWidth, int newHeight) {
    // 图片源
    // Bitmap bm = BitmapFactory.decodeStream(getResources()
    // .openRawResource(id));
    // 获得图片的宽高
    int width = bm.getWidth();
    int height = bm.getHeight();
    // 设置想要的大小
    int newWidth1 = newWidth;
    int newHeight1 = newHeight;
    // 计算缩放比例
    float scaleWidth = ((float) newWidth1) / width;
    float scaleHeight = ((float) newHeight1) / height;
    // 取得想要缩放的matrix参数
    Matrix matrix = new Matrix();
    matrix.postScale(scaleWidth, scaleHeight);
    // 得到新的图片
    Bitmap newbm = Bitmap.createBitmap(bm, 0, 0, width, height, matrix,
    true);
    return newbm;
    }
      

  3.   


    因为服务端丢给我的是个html  客户端会直接在broswer中显示。。所以截取图片太麻烦了
      

  4.   

    如果是htm的话,想要控制图片的尺寸在客户端应该无法实现的,就不清楚了,只能是伸缩htm了
      

  5.   


    一样可以实现。
    new Thread() {
    public void run() {
    Spanned spanned = Html.fromHtml(NEWS_CONTENT,
    new ImageGetter() { @Override
    public Drawable getDrawable(String source) {
    // TODO Auto-generated method stub
    //这个地方对图片做处理
    return drawable;
    }
    }, null);
    }
    }.start();