2017-04-21 132 views
-2

我的手機圖像庫中有高質量的圖像。當我嘗試將這些文件添加到ImageView時,它顯示非常模糊Android ImageView在圖庫中顯示模糊圖像

<ImageView 
     android:id="@+id/img_user" 
     android:layout_width="match_parent" 
     android:layout_height="250dp" 
     android:adjustViewBounds="true" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:background="#CCC" 
     android:scaleType="centerCrop" /> 

爲什麼發生這種情況?

回答

1

試試你的寬度和高度設置爲wrap_content,像這樣:

<ImageView 
     android:id="@+id/img_user" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:adjustViewBounds="true" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:background="#CCC" 
     android:scaleType="centerCrop" /> 

或者,如果你需要保持你的ImageView的大小,請嘗試使用GlidePicasso,以適應裏面的ImageView圖像。

0

刪除高度:250dp並將其設置爲wrap_content,就是這樣吧

相關問題