【问题标题】:control the speed of scrolling in HorizontalScrollView in android控制android中Horizo​​ntalScrollView的滚动速度
【发布时间】:2015-05-30 17:23:27
【问题描述】:

大家好,我对 Android 开发非常缺乏经验,所以我需要你的帮助 :)

问题

我希望用户能够看到图像列表,但一旦他们滚动我希望他们能够转到下一张图像而不是滑动太多并跳过图像

问题

那么有没有办法让滚动速度变慢或者 Horizo​​ntalScrollView 不是我想要的那种视图来实现我想要的东西?

我的代码

  <HorizontalScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:id="@+id/scrollView">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/sample_0"
                android:id="@+id/dog"/>
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/sample_1"/>
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/sample_2" />
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/sample_3"/>

        </LinearLayout>





    </HorizontalScrollView>

【问题讨论】:

    标签: android android-layout


    【解决方案1】:

    我在其他网站Android: HorizontalScrollView smoothScroll animation time(谷歌小搜索:P)中找到了一些关于减慢滚动视图的信息。 但是如果你想显示很多图像,你可能会遇到内存问题,在这种情况下你应该考虑这个Managing Bitmap Memory

    【讨论】:

    • 非常感谢您的回答,但似乎我正在寻找的东西是覆盖 onScroll() 方法。如果我设法弄清楚,我会在这里发布答案:)
    【解决方案2】:

    更新

    我正在写我最终为任何想知道的人所做的事情:)

    最后我要找的是一个 viewPager,我像this 一样实现了它

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-13
      相关资源
      最近更新 更多