Code Monkey home page Code Monkey logo

Comments (11)

tanis2000 avatar tanis2000 commented on June 28, 2024

I tried something similar and it looks like it's not working as expected. I tried smooth scrolling to item 132 in my list but it actually goes to item 98 (all items are the same width of 100px) and the scroll actually doesn't happen. It seems to get stuck on item 0 and then all of a sudden it shows item 98 and surroundings.

from horizontalvariablelistview.

sephiroth74 avatar sephiroth74 commented on June 28, 2024

you must smoothScroll with the amount of pixels to scroll, not the item you want to show. ps. are you using the "development" branch?

from horizontalvariablelistview.

tanis2000 avatar tanis2000 commented on June 28, 2024

I'm calling it like

mList.scrollTo(index*100);

where index is the position and 100 is the width of the item view in pixels.

I'm using the master branch.

from horizontalvariablelistview.

sephiroth74 avatar sephiroth74 commented on June 28, 2024

Try switching to the development branch. It works there. Btw I will update
the demo app also
On May 22, 2013 11:51 AM, "Valerio Santinelli" [email protected]
wrote:

I'm calling it like

mList.scrollTo(index*100);

where index is the position and 100 is the width of the item view in
pixels.

I'm using the master branch.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-18287899
.

from horizontalvariablelistview.

tanis2000 avatar tanis2000 commented on June 28, 2024

The development branch doesn't even scroll close to the position now. It looks like it's not scrolling at all as it's stuck in position 0.

from horizontalvariablelistview.

sephiroth74 avatar sephiroth74 commented on June 28, 2024

try to fetch again the dev branch, then in the MainActivity replace this code:

line 387:
adapter.replace( last, getNextValue() );

with this:
mList.smoothScrollTo( mList.getChildAt( 0 ).getWidth() * 10 );

the list will scroll to the 11° element

from horizontalvariablelistview.

tanis2000 avatar tanis2000 commented on June 28, 2024

Ok, I just tried what you suggested, but it crashes with the following error:

05-24 10:12:53.038      918-918/it.sephiroth.android.sample.horizontalvariablelistviewdemo E/AndroidRuntime: FATAL EXCEPTION: main
        java.lang.NoSuchMethodError: it.sephiroth.android.library.widget.HorizontalVariableListView.postInvalidateOnAnimation
        at it.sephiroth.android.library.widget.HorizontalVariableListView.smoothScrollBy(HorizontalVariableListView.java:2255)
        at it.sephiroth.android.library.widget.HorizontalVariableListView.smoothScrollTo(HorizontalVariableListView.java:2241)
        at it.sephiroth.android.sample.horizontalvariablelistviewdemo.MainActivity.onClick(MainActivity.java:387)
        at android.view.View.performClick(View.java:3540)
        at android.view.View$PerformClick.run(View.java:14167)
        at android.os.Handler.handleCallback(Handler.java:605)
        at android.os.Handler.dispatchMessage(Handler.java:92)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4560)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
        at dalvik.system.NativeStart.main(Native Method)

from horizontalvariablelistview.

sephiroth74 avatar sephiroth74 commented on June 28, 2024

ok, fixed it. btw just change that into postInvalidate() instead

from horizontalvariablelistview.

tanis2000 avatar tanis2000 commented on June 28, 2024

Yes, it works this way. I'm going to try and bring the dev branch into my project and see if it works there as well ;)
Thanks!

from horizontalvariablelistview.

tanis2000 avatar tanis2000 commented on June 28, 2024

I tried with around 200 items in the scrollview and it hangs there for some seconds and then it doesn't scroll. But if I touch the view, it scrolls but not in the correct position.

I tried with scrollTo() instead, but it's pretty much the same.

Have you got any suggestion of what method I could use to just jump to a certain position?

from horizontalvariablelistview.

sephiroth74 avatar sephiroth74 commented on June 28, 2024

yeah, the problem is that the list cannot scroll for more than its width within a single frame...
I've added a temporary solution, checkout the latest developement branch. I've added also a demo in the MainActivity. But a better solution should be found on this.

from horizontalvariablelistview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.