- 博客(1)
- 资源 (7)
- 收藏
- 关注
原创 web开发内嵌tomcat的使用,告别复杂的配置
对于java web开发,最常使用的就是安装tomcat,然后在ide中配置一大堆,然后在进行调试。这种方式对很多新手来说很容易出错。现在说一下使用内嵌的tomcat进行开发。在tomcat官网,我们可以下载对应的内嵌tomcat,在官网长这样。下载解压后将需要用到的jar拷到项目对应的库目录下,然后就可以像普通的java程序一样开发web应用了。下面是启动tomcat的代码。import jav
2017-06-13 14:55:36 8836 2
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关注的人