嘿伙计们,我在 Android 开发方面非常缺乏经验,所以我需要你们的帮助:)
问题
我希望用户能够看到图像列表,但一旦他们滚动,我希望他们能够转到下一个图像,而不是滑动太多并跳过图像
问题
那么有没有办法让滚动速度变慢或者 HorizontalScrollView 不是我想要的 View ,以实现我想要的东西?
我的代码
<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>
最佳答案
我在其他站点找到了一些有关减慢 ScrollView 的信息 Android: HorizontalScrollView smoothScroll animation time (谷歌搜索一下:P)。 但是如果你想显示大量图像,你可能会遇到内存问题,在这种情况下也许你应该考虑这个 Managing Bitmap Memory
关于android - 控制android中HorizontalScrollView的滚动速度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30549160/