首先,我不確定我寫錯代碼的位置。Android - 在不同設備上裁剪的圖像
正如你在截圖中看到的,有3種不同的設備。注意紅色框內的圖像。在的XperiaŽ超屏幕上的圖像已被裁剪,但其餘的是好的:
三星Galaxy SII(Jelly Bean)的
的Nexus 7(奇巧)
Xperia Z Ultra(KitKat)
我把圖像放在一個ListView中,然後在適配器內充氣。以下是自定義行的佈局代碼:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/img_item"
android:src="@drawable/error"
android:adjustViewBounds="true"
android:scaleType="centerCrop" />
</RelativeLayout>
在適配器中,我使用了Picasso圖像加載器來加載圖像。我沒有設置任何圖像縮放選項。
public class ItemPhotoAdapter extends BaseAdapter {
...
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
...
Picasso.with(context) //
.load(iim.getResized()) //
.placeholder(R.drawable.placeholder) //
.error(R.drawable.error)
.into(vh.item_image);
return view;
}
}
任何人都知道這裏發生了什麼?
啊,我知道這一天會來的任何建議如何使編程工作,我只是個初學者,會愛?學習如何; _; – AimanB
@AimanB查看我更新的帖子。這是關於具體,因爲我可以得到而不知道確切需要顯示在每個圖像/行:) – loeschg