Java生成缩略图之Thumbnailator
http://code.google.com/p/thumbnailator/
http://blog.csdn.net/zxingchao2009/article/details/7621197
自定义进度条
http://winwyf.blog.51cto.com/4561999/857867
http://gundumw100.iteye.com/blog/1289348
service 被kill 自启动
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 边缘线的宽度和颜色 -->
<stroke android:width="1px" android:color="#969696" />
<!-- 中间渐变,角度0从左往右,正值为逆时针,270度为从上到下 -->
<gradient android:startColor="#ffffff" android:centerColor="#e9e9e9" android:endColor="#d8d8d8" android:angle="270"/>
<!-- 设置四个角的角度 -->
<corners android:topLeftRadius="5dp" android:topRightRadius="5dp" android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp"/>
<!-- 设置padding -->
<padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp"/>
</shape>
(1)它只能作为XML布局声明的root元素来使用;
{
if (view != null)
{
BitmapDrawable bd = (BitmapDrawable) view.getBackground();
rceycleBitmapDrawable(bd);
}
}
private void recycleImageViewBitMap(ImageView imageView)
{
if (imageView != null)
{
BitmapDrawable bd = (BitmapDrawable) imageView.getDrawable();
rceycleBitmapDrawable(bd);
}
}
private void rceycleBitmapDrawable(BitmapDrawable bd)
{
if (bd != null)
{
Bitmap bitmap = bd.getBitmap();
rceycleBitmap(bitmap);
}
bd = null;
}
private void rceycleBitmap(Bitmap bitmap)
{
if (bitmap != null && !bitmap.isRecycled())
{
bitmap.recycle();
bitmap = null;
}
Bitmap bm = BitmapFactory.decodeResource(this.getResources(), R.drawable.splash);
BitmapDrawable bd = new BitmapDrawable(this.getResources(), bm);
mBtn.setBackgroundDrawable(bd);
来代替mBtn.setBackgroundResource(R.drawable.splash)。
销毁的时候使用:
BitmapDrawable bd = (BitmapDrawable)mBtn.getBackground();
mBtn.setBackgroundResource(0);//别忘了把背景设为null,避免onDraw刷新背景时候出现used a recycled bitmap错误
bd.setCallback(null);
bd.getBitmap().recycle();