带有图像的 ScrollView Android

ScrollView Android with images

我想在垂直滚动视图中放置三张图片,我不知道为什么,但我只看到了第三张 ( tuto3 )。

这里是 xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/scrollView" >

        <LinearLayout
            android:id="@+id/linearLayout42"
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </LinearLayout>

    </ScrollView>

</LinearLayout>

还有 class:

public class about extends ActionBarActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.aboutlayout);
        LinearLayout ll = (LinearLayout) findViewById(R.id.linearLayout42);
        ImageView image = new ImageView(about.this);
        image.setBackgroundResource(R.drawable.tuto1);
        ll.addView(image);
        ImageView image2 = new ImageView(about.this);
        image.setBackgroundResource(R.drawable.tuto2);
        ll.addView(image2);
        ImageView image3 = new ImageView(about.this);
        image.setBackgroundResource(R.drawable.tuto3);
        ll.addView(image3);
    }
}

您一直在 image 上调用 setBackgroundResource,而不是 imageimage1image2