2013-03-28 147 views
0

我正在使用gridview显示图像,如此处所述http://developer.android.com/guide/topics/ui/layout/gridview.htmlsetImageDrawable图像模糊

我的适配器getView()方法是:

@Override 
    public View getView(int position, View convertView, ViewGroup parent) { 
     // TODO Auto-generated method stub 
     Log.i("count",""+1); 
     ImageView imageView; 
     ViewHolder holder = null; 
     if (convertView == null) { 
      imageView = new ImageView(context); 
      imageView.setLayoutParams(new GridView.LayoutParams(85, 95)); 
      imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); 
      imageView.setPadding(3, 3, 3, 3); 


     } 
     else{ 
      imageView = (ImageView) convertView; 

     } 
     String bookTemp = books.get(position); 
     imageView.setImageDrawable(context.getResources().getDrawable(R.drawable.book1)); 
     //imageView.setImageResource(R.drawable.book2); 
     return imageView; 
    } 

但我的设备显示图像是blurred.I试图改变大小也不过结果出来一样每再寄一次我不是得到什么我我在这里做错了吗?我还附加了下面的示例图片以及我用于测试的示例图片。

enter image description here

+0

这些东西点击阅读更多的是它们在低质量的显示或真的很模糊? – k0sh 2013-03-28 09:10:12

+0

你的手机密度和R.drawable.book1大小是多少? – 2013-03-28 09:11:18

+0

@StyleMe只有模糊,我的电话密度为LDPI – Anshul 2013-03-28 09:11:30

回答

0

抱歉,我不得不作出它的答案根据文档回答您的问题之上:
Android将治疗上,他们是在下面的文件夹,推杆的影像基地。

ldpi: Low-density screens; approximately 120dpi. 
mdpi: Medium-density (on traditional HVGA) screens; approximately 160dpi. 
hdpi: High-density screens; approximately 240dpi. 
xhdpi: Extra high-density screens; approximately 320dpi. Added in API Level 8 
nodpi: This can be used for bitmap resources that you do not want to be scaled to match the device density. 
tvdpi: Screens somewhere between mdpi and hdpi; approximately 213dpi. This is not considered a "primary" density group. It is mostly intended for televisions and most apps shouldn't need it—providing mdpi and hdpi resources is sufficient for most apps and the system will scale them as appropriate. This qualifier was introduced with API level 13. 

约上this