使页面可滚动

时间:2014-08-30 06:35:27

标签: android

我必须在Android页面中添加大约15个图像。但是在eclipse中现有的图形布局中,我只能添加许多将填充页面的图像,比如四个。如何添加其余的这些图像,以便它们在滚动时显示在这些图像下方。换句话说如何扩展页面?

2 个答案:

答案 0 :(得分:2)

尝试使用滚动视图

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

        <!-- everything you already have -->

</ScrollView>

答案 1 :(得分:1)

使用ScrollView因为你只需要15张图像,如果图像是日常的,而不是使用List for dishpaly images

<强> image_scroll_layout.xml

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="your_image" />

          ........up to 15

       <ImageView
            android:id="@+id/imageView15"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="your_image" />
    </LinearLayout>
</ScrollView>
相关问题