Comments (11)
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.
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.
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.
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.
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.
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.
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.
ok, fixed it. btw just change that into postInvalidate() instead
from horizontalvariablelistview.
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.
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.
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)
- How to change default color(yellow) when press item HOT 1
- StackoverflowError on Android 2 HOT 3
- change the touch background color of HListView HOT 1
- Item width not being handled accurately HOT 2
- two listview in one layout Don't call SlideMenuClickListener
- I want to the focus on the last item view when switched by KEYCODE_DPAD_RIGHT on TV?
- Can HorizontalListView work with Espresso?
- FloatMath.sqrt has been removed from Android SDK 23 HOT 4
- setSelection method is not working
- setItemsCanFocus is not work
- Proguard required HOT 1
- Grade Line
- Implementing Onitemclicklistener
- Array Index of Bound Exception when trying to remove selected position HOT 2
- lock(freeze) the scroll
- Android 8 setOnItemClickListener is not Working when clicked on Image HOT 3
- Feature Request: Migrate to Android X
- Button ClickListener not working Fragment to Fragment
- My App get crashed : NullpointerExcetion
- AbsHListView.smoothScrollToPositionFromLeft does not scroll correctly when position is the next visible item
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from horizontalvariablelistview.