后台是用的FCKeditor上传的商品详情,保存为html 格式 。因为在网站上也要显示,图片的尺寸较大,在手机上图片显示不下,怎么破?有没有好的意见?首次在CSDN提问,不懂行事。。请多包涵手机fckeditor
解决方案 »
- 请问这个效果如何实现?小白求教!
- 配置文件出错?Unknown C compiler arm-linux-androideabi-gcc ?
- 如何去掉:退出程序后默认回到登录界面,但“usernameTxt”框依然显示刚登录过的用户名
- android 中back键 和home键 个监听的那个函数
- 关于EditText上下文的问题
- android 上传图片不显示问题
- android程序在虚拟机上运行出错
- 运行出现not an ArmV7 Cpu; cpu doesn't support neon
- 安卓 登录页面向上平移效果
- 如何动态加载 activity_main
- android报错LogCat报错如下
- 线程不能捕获connectionexcption异常问题
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;
}
因为服务端丢给我的是个html 客户端会直接在broswer中显示。。所以截取图片太麻烦了
一样可以实现。
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();