2013-03-28 201 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