catchiecop
catchiecop

Reputation: 388

control the speed of scrolling in HorizontalScrollView in android

hey guys I'm pretty inexpirienced in Android Development so I need your help :)

The Issue

I want the user to be able to see a list of images but as soon as they scroll I want them to be able to go the next image and not slide too much and skip images

The Question

So is there a way to make the scrolling speed slower or HorizontalScrollView is not the kind of view I want in order to achieve the thing I want?

My Code

  <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>

Upvotes: 2

Views: 1659

Answers (2)

catchiecop
catchiecop

Reputation: 388

UPDATE

I'm writting what I ended up doing for anyone who wants to know :)

In the end the thing I was looking for was a viewPager which I implemented like this

Upvotes: 1

Pęgaz
Pęgaz

Reputation: 46

I found some information about slowing down Scroll view in other site Android: HorizontalScrollView smoothScroll animation time (little google search :P). But if you want do display alot of images, u could have problems with memory, in that situation maybe u should consider this Managing Bitmap Memory

Upvotes: 1

Related Questions