是否可以滚动的ListView到listrow的子元素? [英] Is it possible to scroll ListView to a listrow's child element?

查看:154
本文介绍了是否可以滚动的ListView到listrow的子元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相当高行一个ListView。该行具有相当复杂的布局,我想获得的ListView滚动到一排完全是一个子元素。这可能吗?

我只找到.smoothScollToPosition(),但我只能在指定一整排。我需要更多的东西precise,到如滚动到一排中间一个子元素

感谢。

解决方案

看看ListView的方法<一href="http://developer.android.com/reference/android/widget/AbsListView.html#smoothScrollToPositionFromTop%28int,%20int,%20int%29"相对=nofollow> smoothScrollToPositionFromTop (从AbsListView继承)<​​/ P>

  

平滑滚动到指定的   适配器的位置。该视图将滚动   这样,所指明的位置是   显示的偏移量的像素从顶部   视图的边缘。如果这是   不可能的,(例如,偏移量将   滚动超出了第一个或最后一个项目   列表的边界)它将   得到尽可能接近。滚动   将时间毫秒   完成了。

您会负责计算偏移所需的一排中间的土地 - 这超出了你的问题的范围,因为它的立场。

I have a ListView with quite "high" rows. The rows have quite complex layouts, and I'd like to get ListView to scroll to exactly a child element of a row. Is this possible?

I've only found .smoothScollToPosition(), but I can only specify a whole row in that. I need something more precise, to e.g. scroll to a child element in the middle of a row.

Thanks.

解决方案

Take a look at the ListView method smoothScrollToPositionFromTop (inherited from 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.

You'll be responsible for calculating the offset required to land in the middle of a row - that is beyond the scope of your question as it stands.

这篇关于是否可以滚动的ListView到listrow的子元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆