Obsolete
Status Update
Comments
ra...@gmail.com <ra...@gmail.com> #2
Looking at the android source, it does seem to relate to the positioning within the groups vs. children.
A work-around is to implement SectionIndexer in a custom adapter, but that may not be appropriate in al cases.
A work-around is to implement SectionIndexer in a custom adapter, but that may not be appropriate in al cases.
ro...@android.com <ro...@android.com>
ra...@gmail.com <ra...@gmail.com> #3
Another observation: implementing SectionIndexer does NOT help when you have a small number of huge groups (eg. two groups, first with 50 and second with 500)...it just jumps from start to end.
ra...@gmail.com <ra...@gmail.com> #4
I have re-implemented FastScroller.java and it seems to work as I would expect; I have appened it to this comment. I have copied the comments at the top of the file here:
*
* This is a substantially modified version of the Android 2.3 FastScroller.
*
* The original did not work correctly with ExpandableListViews; the thumb would work
* for only a small portion of fully expanded views and exhibited odd behaviour with
* view with a small number of groups but large children.
*
* The underlying approach to scrolling with a summary in the original version was
* also flawed: it translated a thumb position of 50% to mean that the middle summaryGroup
* should be visible. While this may seem sensible, it is contrary to reasonable expectations with
* scrollable lists: a thumb at 50% in any scrollable list should result in the list being at
* the mid-point. With an expandableListView, this needs to take into account the total
* number of items (groups and children), NOT just the summary groups. Doing what the original
* implementaion did is not only counter-intuitive, but also makes the thumb unusable in the case of
* n groups, where one of those n has O(n) children, and is expanded. In this case, the entire set
* of children will move through the screen based on the same finger movement as moving between
* two unexpanded groups. In the more general case it can be characterised as uneven scrolling
* if sections have widely varying sizes.
*
* Finally, the original would fail to correctly place the overlay if setFastScrollEnabled was
* called after the Activity had been fuly drawn: this is because the only place that set the
* overlay position was in the onSizeChanged event.
*
* Combine this with the desire to display more than a single letter in the overlay,
* and a rewrite was more or less essential.
*
* The solution is:
*
* - modify init() to fake an onSizeChanged event
* - modify onSizeChanged() to make the overlay 75% of total width;
* - modify draw() to handle arbitrary text (ellipsize if necessary)
* - modify scrollTo() to just deal with list contents and not try to do any fancy
* calculations about group position.
*
* Because the original was in the android package, it had access to classes that we do not
* have access to, so in some cases we now check if mList is an ExpandableListView rather than
* checking if the adapter is an ExpandableListConnector.
*
* *********************************************************
*
* NOTE: any class implementing a SectionIndexer for this object MUST return flattened
* positions in calls to getPositionForSection(), and will be passed flattened positions in
* calls to getSectionForPosition().
*
* *********************************************************
*
* This is a substantially modified version of the Android 2.3 FastScroller.
*
* The original did not work correctly with ExpandableListViews; the thumb would work
* for only a small portion of fully expanded views and exhibited odd behaviour with
* view with a small number of groups but large children.
*
* The underlying approach to scrolling with a summary in the original version was
* also flawed: it translated a thumb position of 50% to mean that the middle summaryGroup
* should be visible. While this may seem sensible, it is contrary to reasonable expectations with
* scrollable lists: a thumb at 50% in any scrollable list should result in the list being at
* the mid-point. With an expandableListView, this needs to take into account the total
* number of items (groups and children), NOT just the summary groups. Doing what the original
* implementaion did is not only counter-intuitive, but also makes the thumb unusable in the case of
* n groups, where one of those n has O(n) children, and is expanded. In this case, the entire set
* of children will move through the screen based on the same finger movement as moving between
* two unexpanded groups. In the more general case it can be characterised as uneven scrolling
* if sections have widely varying sizes.
*
* Finally, the original would fail to correctly place the overlay if setFastScrollEnabled was
* called after the Activity had been fuly drawn: this is because the only place that set the
* overlay position was in the onSizeChanged event.
*
* Combine this with the desire to display more than a single letter in the overlay,
* and a rewrite was more or less essential.
*
* The solution is:
*
* - modify init() to fake an onSizeChanged event
* - modify onSizeChanged() to make the overlay 75% of total width;
* - modify draw() to handle arbitrary text (ellipsize if necessary)
* - modify scrollTo() to just deal with list contents and not try to do any fancy
* calculations about group position.
*
* Because the original was in the android package, it had access to classes that we do not
* have access to, so in some cases we now check if mList is an ExpandableListView rather than
* checking if the adapter is an ExpandableListConnector.
*
* *********************************************************
*
* NOTE: any class implementing a SectionIndexer for this object MUST return flattened
* positions in calls to getPositionForSection(), and will be passed flattened positions in
* calls to getSectionForPosition().
*
* *********************************************************
ad...@android.com <ad...@android.com> #5
Contributions should be submitted to https://android-review.googlesource.com - we cannot accept contributions as attachments here.
ra...@gmail.com <ra...@gmail.com> #6
Its probably better to view it as a demonstration of the analysis of the bug as well as a work-around for other people who encounter the bug.
an...@gmail.com <an...@gmail.com> #7
I still got the same issue today, tried on Android 2.3.
br...@gmail.com <br...@gmail.com> #8
Had the same issue on 4.0
@Rabid, in the FastScroller class, what does it reference on
R.drawable.scrollbar_handle_accelerated_anim2 and
R.drawable.menu_submenu_background
on lines 186 and 188 ?
Thanks for sharing !
@Rabid, in the FastScroller class, what does it reference on
R.drawable.scrollbar_handle_accelerated_anim2 and
R.drawable.menu_submenu_background
on lines 186 and 188 ?
Thanks for sharing !
al...@android.com <al...@android.com>
yo...@gmail.com <yo...@gmail.com> #9
Can someone guide me on how to implement this FastScroll.java into my ExpandableListView? Thank you
al...@android.com <al...@android.com> #10
Please use a forum like StackOverflow for development help.
ha...@gmail.com <ha...@gmail.com> #11
Z90
sa...@google.com <sa...@google.com> #12
Thank you for your feedback. We assure you that we are doing our best to address all issues reported. For now, we will be closing the issue as won't fix obsolete. If this issue currently still exists, we request that you log a new issue along with the bug report here https://goo.gl/TbMiIO and reference this bug for context.
Description
- Build an ExpandableListView with many children
- Expand each node (in my case I went from 300+ nodes to 1000-ish nodes in list)
- Scroll using gestures. Everything looks good
- Grab the thumb...and it seems to think the 'end' of the list is about 1/3rd of the way down it's scroll range.
My suspicion is that it knows how long the list is, but that when tells the list to move to a certain position, the list uses the 'group position' NOT the actual list item position...so 1/3rd down the scroll bar would be item 300-ish, it tells the list to move to position 300...and it moves to GROUP 300 (more or less at end).
2. What happened.
See above
3. What you think the correct behavior should be.
The list should be in sync with the thumb position.
4. Version of Android you're using
Android 2.2; tried on 1.6 also. Used AVD and HTC Desire.