Android: Picasso - URLS 不正确地填充 ImageViews

Android: Picasso - URLS Improperly Populating ImageViews

我正在尝试使用 Picasso 填充一系列 ImageViews - 但是由于某种原因 - 只填充了第一张图像。谁能说出为什么会这样?我已经看过很多次了,但我似乎无法在这个 for 循环中发现问题:

调试/记录:

09-26 23:10:58.445: I/System.out(14978): WTF :https://i.ytimg.com/vi/oSYctdFjFSw/default.jpg
09-26 23:10:58.456: I/System.out(14978): WTF : https://i.ytimg.com/vi/DyFE4IEjX4I/default.jpg
09-26 23:10:58.466: I/System.out(14978): WTF : https://i.ytimg.com/vi/6XCU_Wv0ekA/default.jpg
09-26 23:10:58.475: I/System.out(14978): WTF : https://i.ytimg.com/vi/5U1ndFiYLh4/default.jpg
09-26 23:10:58.483: I/System.out(14978): WTF : https://i.ytimg.com/vi/6gLscCEiSXE/default.jpg

来源:

    ImageView imageItem1;
    for (int i = 0; i < 3; ++i) {
        // Create new ImageView
        imageItem1 = new ImageView(this);

        // Set the shadow background
        imageItem1.setBackgroundResource(R.drawable.shadow);
        String[] separated = result.toString().replace("[", "").replace("]", "").split(",");
        String scrubbedURL = separated[j].toString();
        Picasso.with(this).load(scrubbedURL).into(imageItem1);
        System.out.println("WTF :" + scrubbedURL);
        // Set the size of the image view to the previously computed value
        imageItem1.setLayoutParams(new LinearLayout.LayoutParams(
                imageWidth, imageWidth));

        // / Add image view to the carousel container
        mCarouselContainer1.addView(imageItem1);
        ++j;
    }

结果:

如有任何建议/评论/见解,我们将不胜感激……我很难过。

尝试:

ImageView imageItem1;
String[] separated = result.toString().replace("[", "").replace("]", "").split(",");
for (int i = 0; i < 3; ++i) {
    // Create new ImageView
    imageItem1 = new ImageView(this);

    // Set the shadow background
    imageItem1.setBackgroundResource(R.drawable.shadow);

    String scrubbedURL = separated[j].trim();
    ...
    ++j;
}