android – 是否可以将ListView滚动到listrow的子元素?

前端之家收集整理的这篇文章主要介绍了android – 是否可以将ListView滚动到listrow的子元素?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我有一个具有相当“高”行的ListView.行具有相当复杂的布局,我想让ListView滚动到一行的子元素.这可能吗?

我只找到.smoothScollToPosition(),但我只能指定整行.我需要更精确的东西,例如滚动到行中间的子元素.

谢谢.

最佳答案
@H_403_10@看一下ListView方法smoothScrollToPositionFromTop(继承自AbsListView)

Smoothly scroll to the specified
adapter position. The view will scroll
such that the indicated position is
displayed offset pixels from the top
edge of the view. If this is
impossible,(e.g. the offset would
scroll the first or last item beyond
the boundaries of the list) it will
get as close as possible. The scroll
will take duration milliseconds to
complete.

您将负责计算在连续中间着陆所需的偏移量 – 这超出了您的问题的范围.

猜你在找的Android相关文章