android listview 第一个可见位置

标签 android listview

<分区>

如何更改 ListView 中的第一个可见项(我搜索了 setFirstVisiblePosition 等方法)?

最佳答案

ListView.getFirstVisiblePosition()  

Returns the position within the adapter's data set for the first item displayed on screen. Once you have the position, you can alter the item at that position in your adapter.

假设我的适配器将 String[] 绑定(bind)到 ListView。我可以在 ListView 实例上使用 getFirstVisiblePosition() 方法,这将返回第一个可见项的索引/位置,然后我可以在第“索引”位置更改我的字符串项并更改列表.

关于android listview 第一个可见位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2041300/

相关文章:

android - ListView,在 Android 1.6 上不检查可检查项目

android - ListView 未在选项卡 View 中完整查看

android如何像在聊天应用程序中一样将项目动态添加到 ListView

java - 在 Firebase 类中找不到名称的 setter /字段

android - 以编程方式播放 YouTubePlayer 不起作用

android - 如何动态添加按钮和总计?

返回失败的 android 相机图片 uri 传递结果 ResultInfo

android - 在 Android 的输入过滤器中使用条件 maxLength

android - Android屏幕左侧的垂直菜单

listview - 防止 RTL TListView 镜像复选框和/或图形