我有一个 imageView
scaleType="centerCrop"
图像在 ViewPager 中显示,具有滑动功能。 我正在使用 picasso 加载图像,但图像在左上角被切断,如下所示:
这是 xml 代码:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/img_sliding"
android:scaleType="centerCrop"
android:layout_width="match_parent"
android:layout_height="match_parent" />
加载图像的代码是:
if (imgList!=null && imgList.size()>0)
Picasso.with(getActivity())
.load(imgList.get(position))
.placeholder(drawable)
.into(imgView);
所以,我不明白为什么会发生这种情况,而且零件的切口有时被蓝色覆盖,有时被绿色覆盖。
感谢任何帮助。 谢谢
最佳答案
看来您已启用 Picasso
的调试指示器。
尝试以下操作:
Picasso picasso = Picasso.with(getApplicationContext());
picasso.setIndicatorsEnabled(false); // disabling the indicators
picasso
.load(imgList.get(position))
.placeholder(drawable)
.into(imgView);
或者在代码中查找 setIndicatorsEnabled(true)
并将其删除。
关于Android ImageView ,图像在左上角被截断,如何避免 id?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37782521/