1.RecyclerView设置divider:
链接
代码方法的话比较麻烦,如果只是想设置简单的divider,直接在item的layout里画一条线就可以了
2.BitmapDrawable from TransitionDrawable
android.graphics.drawable.TransitionDrawable cannot be cast to android.graphics.drawable.BitmapDrawable
链接
//in this case your solution would be right, one can just cast it, //but if not (and that is your case) one needs to do something like //that:
private Bitmap getBitmap(Drawable icon) {
Bitmap result;
if (icon instanceof BitmapDrawable) {
result = ((BitmapDrawable) icon).getBitmap();
} else {
Bitmap bitmap = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
icon.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
icon.draw(canvas);
result = bitmap;
}
return result;
}
3.RecyclerView 加载url图片,平滑滚动的问题: Glide开源项目
listview 为了保持图片位置不错乱,需要setTag;
改用recycler后,从volley换到glide