I have an ExpandableListView that is filled with items. When you click on an item on the top level it opens up the next level which shows a list that contains some additional information about each item. For some of the top items(groups) when I click on them it opens up the bottom items(children) and does nothing else. But for other groups when I click on them it opens up the children and scrolls me all the way down to the last child of that group. Does anyone know why it does this for some items and not others? And is there any way to get rid of this effect and just leave the list scrolled to the same position its already in?
Edit: I just realized it does this scrolling only for the bottom half of the items in the top level. That is, there are 14 items in the top level, for items 8-14 when you click on them it scrolls down so that the last child is on the bottom of the screen. If you click on items 1-7 the children open up and nothing else happens.
Edit2: @coldForged as far as I know I am using a standard ExpandableListView here is the xml from my layout:
<ExpandableListView
android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/paper"
android:scrollingCache="false"
android:scrollbars="none"
>
</ExpandableListView>
Could the scrollingCache="false" attribute be causing this? I had to set this attribute to get it to show the background image even while the list is being scrolled. Without this attribute the list background turns to black while its scrolling.
It's the standard ExpandableListView behavior. It tries to show all the items of the group that the user just expanded. In your case expanding groups 1-7 does not hide any children, but for other groups it does, so the list scrolls.
I was facing the same problem and found the really simple solution here : [Android ExpandableListView Scroll to Expanded Group Position]
Edit: Since the link dies once a month here the really simple solution: Just set the
android:transciptMode="disabled"
. This prevents the scroll to the last list position.For further reading: Transcript mode in Android docs