在 ListView 中更改记录结尾的颜色

Change color of end of record in ListView

是否可以更改 listView 滚动末尾的颜色。当我滚动到 listview 的末尾或 listView 的开头时,我在滚动末尾的顶部和底部看到白色。我可以更改那个颜色吗?

谢谢!

要更改最后一项的颜色,

if (position == list.length - 1) {
    holder.title.setTextColor(Color.RED);
}else{   
    holder.title.setTextColor(Color.BLACK);
}

您可以在适配器的 getview 函数中执行此操作,每次在屏幕上显示新的列表视图项目时,getview 函数都会被调用。在您的 getview 函数中将 if else 语句放在下面

if(position == 0 || position == getCount()){
   // change to the color you want to change
} else {
  // change back to the normal color
}