开发者

Problem with ExpandableListView position

开发者 https://www.devze.com 2023-01-04 03:55 出处:网络
I have a \"Dynamic\" ExpandableListView. That is to say child are only load when there is click on there parent.

I have a "Dynamic" ExpandableListView. That is to say child are only load when there is click on there parent.

So I use onGroupExpand to load list. It works but I must expand myself the group with

expandableList.expandGroup(groupPosition);

The problem is that, when I click on parent, the group expands but the view go back to the first position. That is to say : I scroll, I click on parent, group expand, view go back to the first parent, so I must scroll again to see the group I click before.

I try to use expandableLis开发者_JAVA技巧t.scrollTo(x,y); But it doesn't work.


I am having a similar problem. I found this method that lets you scroll based on an item position :

mList.smoothScrollToPosition(pos);

The downside is I have to call this from my groupClickListener() and in order to get it to work I have to put it inside of a runnable and delay it by part of a second otherwise it will do nothing. This means my list scrolls one way then stops and scrolls back to where it was, which looks weird. But its the only thing I've come up with thus far.

0

精彩评论

暂无评论...
验证码 换一张
取 消