无限垂直ScrollView

时间:2015-03-04 08:52:05

标签: android

我有一个垂直的ScrollView,我想让它无限。当显示最后一个项目时,我希望第一个项目出现,所以一个。有人可以给我一些建议吗?

<ScrollView
android:id="@+id/scrollViewId"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_weight="0.49">
<!-- Right button bar -->
<LinearLayout
    android:id="@+id/button_bar"
    android:layout_width="@dimen/buttonbar_height"
    android:layout_height="match_parent"
    android:orientation="vertical"
    style="@style/ButtonBar.Bottom">
    <ImageButton
        android:id="@+id/home"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:layout_width="match_parent"
        style="@style/Widget.Button.Borderless"
        android:src="?attr/iconHome"
        android:contentDescription="@string/home"/>
    <ImageButton
        android:id="@+id/movies"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:layout_width="match_parent"
        style="@style/Widget.Button.Borderless"
        android:src="?attr/iconMovies"
        android:contentDescription="@string/movies"/>
    <ImageButton
        android:id="@+id/tv_shows"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:layout_width="match_parent"
        style="@style/Widget.Button.Borderless"
        android:src="?attr/iconTvShows"
        android:contentDescription="@string/tv_shows"/>
</LinearLayout>

1 个答案:

答案 0 :(得分:0)

我不知道为什么你想要一个带有“INFINITE”滚动的垂直滚动视图!但无论如何,我的想法是:

第一次在scrollview中添加元素。然后,您可以找到滚动视图的结尾。到达滚动视图的末尾时,使用在已填充元素下添加的相同元素重新填充滚动视图。通过这种方式,只要scrollview将到达它的end元素,就会不断填充越来越多的元素。

要查找scrollview的底部,您可以参考此内容 link或类似的此类链接。