这是其中的一个方法,参数resld是这样:ImageView.setImageResource(R.drawable.icon); 看下面这段话Sets a drawable as the content of this ImageView.This does Bitmap reading and decoding on the UI thread, which can cause a latency hiccup. If that"s a concern, consider usingsetImageDrawable(Drawable) or setImageBitmap(Bitmap) and BitmapFactory instead.此函数使用UI线程,可以用下面3种替代:ImageView iv;
ImageView iv = new ImageView(context); iv.setImageResource(iv[position]); iv.setScaleType(ImageView.ScaleType.FIT_XY); iv.setLayoutParams(new Gallery.LayoutParams(136,88));