//通过openRawResource获取一个inputStream对象
InputStream inputStream = getResources().openRawResource(R.drawable.temp);
//通过一个InputStream创建一个BitmapDrawable对象
BitmapDrawable drawable = new BitmapDrawable(inputStream);
//通过BitmapDrawable对象获得Bitmap对象
Bitmap bitmap = drawable.getBitmap();
//利用Bitmap对象创建缩略图
bitmap = ThumbnailUtils.extractThumbnail(bitmap, 51, 108);
//imageView 显示缩略图的ImageView
imageView.setImageBitmap(bitmap);