我的应用程序中有一个图库,但是当我加载图片时,我的分辨率与下图相同。这些图像的分辨率为 300x300。即使增加图像的分辨率,我也会看到相同的分辨率..
你能帮助我吗?
我的适配器
public class ImageAdapter extends BaseAdapter {
int mGalleryItemBackground;
private Context mContext;
private Activity activity;
private ArrayList<String> urls;
private ImageLoader imageLoader;
private int largura;
private int altura;
public ImageAdapter(Activity acivity,Context c,ArrayList<String> urls,int largura, int altura) {
this.activity = acivity;
this.urls = urls;
this.largura = largura;
this.altura = altura;
mContext = c;
TypedArray a = mContext.obtainStyledAttributes(R.styleable.MapAttrs);
mGalleryItemBackground = a.getResourceId(
R.styleable.HelloGallery_android_galleryItemBackground, 0);
a.recycle();
imageLoader=new ImageLoader(activity.getApplicationContext());
}
public int getCount() {
return urls.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
int largura = this.largura;
int altura = this.altura/3;
ImageView i = null;
if(convertView == null)
i = new ImageView(mContext);
//i.setImageResource(mImageIds[position]);
i.setDrawingCacheQuality(100);
i.setScaleType(ImageView.ScaleType.FIT_XY);
i.setBackgroundResource(mGalleryItemBackground);
//i.setLayoutParams(new Gallery.LayoutParams(largura,altura));
i.getLayoutParams().height = 300;
i.getLayoutParams().width = 300;
imageLoader.DisplayImage(urls.get(position), i);
return i;
}
}
显示图像
public void DisplayImage(String url, ImageView imageView)
{
imageViews.put(imageView, url);
Bitmap bitmap = BitmapFactory.decodeFile(url);
if(bitmap!=null)
imageView.setImageBitmap(bitmap);
else
{
queuePhoto(url, imageView);
imageView.setImageResource(stub_id);
}
}
布局
<Gallery
android:id="@+id/gallery" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="5sp"
/>