确保在Android的ListView可见?Android、ListView

2023-09-13 00:59:31 作者:陌上花开倾城时

有没有办法,我可以在Android的ListView makle确定某一项目的方式是完全可见?

Is there a way that I can makle sure a given item in an android listview is entirely visible?

我希望能够以编程方式滚动到一个特定的项目,就像当我preSS例如按钮。

I'd like to be able to programmatically scroll to a specific item, like when I press a button for example.

推荐答案

ListView.setSelection()将滚动列表,以便所需的项目是在视口中。

ListView.setSelection() will scroll the list so that the desired item is within the viewport.