- 博客(1)
- 资源 (7)
- 收藏
- 关注
翻译 使用spring创建一个RESTful Web Service
原文地址:https://spring.io/guides/gs/rest-service/ 这篇文章引导你使用spring创建一个 "hello world" 的RESTful web service . 你将创建什么 你将创建一个可以接受http get请求的服务: http://localhost:8080/greeting 通过
2016-04-26 16:38:00 663
android Textview 实现html 图片显示
android Textview 实现html 图片点击 两种方式
一种是用webview ,调用jsInterface实现
另一种是 textview 使用Html.from()方法
2015-07-24
picasso 图片库
github 地址 https://github.com/square/picasso
ADAPTER DOWNLOADS
Adapter re-use is automatically detected and the previous download canceled.
@Override public void getView(int position, View convertView, ViewGroup parent) {
SquaredImageView view = (SquaredImageView) convertView;
if (view == null) {
view = new SquaredImageView(context);
}
String url = getItem(position);
Picasso.with(context).load(url).into(view);
}
IMAGE TRANSFORMATIONS
Transform images to better fit into layouts and to reduce memory size.
Picasso.with(context)
.load(url)
.resize(50, 50)
.centerCrop()
.into(imageView)
You can also specify custom transformations for more advanced effects.
public class CropSquareTransformation implements Transformation {
@Override public Bitmap transform(Bitmap source) {
int size = Math.min(source.getWidth(), source.getHeight());
int x = (source.getWidth() - size) / 2;
int y = (source.getHeight() - size) / 2;
Bitmap result = Bitmap.createBitmap(source, x, y, size, size);
if (result != source) {
source.recycle();
}
return result;
}
@Override public String key() { return "square()"; }
}
Pass an instance of this class to the transform method.
PLACE HOLDERS
Picasso supports both download and error placeholders as optional features.
Picasso.with(context)
.load(url)
.placeholder(R.drawable.user_placeholder)
.error(R.drawable.user_placeholder_error)
.into(imageView);
A request will be retried three times before the error placeholder is shown.
RESOURCE LOADING
Resources, assets, files, content providers are all supported as image sources.
Picasso.with(context).load(R.drawable.landing_screen).into(imageView1);
Picasso.with(context).load("file:///android_asset/DvpvklR.png").into(imageView2);
Picasso.with(context).load(new File(...)).into(imageView3);
DEBUG INDICATORS
For development you can enable the display of a colored ribbon which indicates the image source. Call setIndicatorsEnabled(true) on the Picasso instance.
2015-06-19
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人