Android Picasso resize()不一致

时间:2015-07-01 09:49:17

标签: android resize picasso

我正在使用Picasso在我的Android界面上调整背景图像的大小。

我正在拉伸图像的宽度以填充宽度,但我无法调整高度,因为背景图像需要与中间的圆形图像对齐。

问题是,在不同的设备上,高度似乎会调整,因为背景不是一致的。我会发一个例子,但我不能,因为我还没有10个声誉。

这是我的java

ImageView imgBackground = (ImageView) v.findViewById(R.id.imgBackground);
aParent = (MainActivity) getActivity();

//Picasso.with(getActivity()).load(R.drawable.morn_blur_bg).fetch();
Picasso.with(aParent.getApplicationContext())
        .load(R.drawable.morn_blur_bg)
        .resize(aParent.getBackgroundWidth(), aParent.getBackgroundHeight())
        .into(imgBackground);

这是我的XML

<ImageView
    android:id="@+id/imgBackground"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scaleType="center"
    android:layout_alignParentTop="true" />

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

事实证明,在毕加索完成它之后,imageview正在拉伸图像。

我试图设置imageview高度,但操作系统覆盖了我。

最后我设置了imageView.scaletype =&#34;矩阵&#34;,现在它不会拉伸我的图像。

希望能帮助别人,我花了很多时间在这上面。