Android ListView 将 headers 部分排除在突出显示之外

Android ListView exclude section headers from being highlighted

我最近实现了 github 的 StickyListHeadersListview 库。然后我使用 MultiChoiceModeListener 选择项目,然后复制或删除那些选定的元素,如下所示

我不想突出显示 headers 部分(日期字段)。有什么方法可以禁用此行为。

这个问题源于我上一个未回答的问题。请参阅 link 自定义阵列适配器代码

Change the background color of your view using View.setBackgroundColor(); method.

在您的 getHeaderView() 方法中添加此行

convertView.setBackgroundColor(your color)

  @Override
    public View getHeaderView(int position, View convertView, ViewGroup parent) {
        HeaderViewHolder holder;

        if (convertView == null) {
           holder = new HeaderViewHolder();
           convertView = mInflater.inflate(R.layout.date_separator, parent, false);

            convertView.setBackgroundColor(your color);// change here

         }                

         return convertView;
    }