gzix
gzix

Reputation: 269

Android ListView exclude section headers from being highlighted

I have recently implemented the StickyListHeadersListview library from github. Then I used MultiChoiceModeListener for selecting items and then to copy or delete those selected elements as seen below

I don't want the section headers (date field) to get highlighted. Is there any way to disable this behaviour.

This question originated from my last unanswered question. Refer the link for custom array adapter code

enter image description here

Upvotes: 0

Views: 357

Answers (1)

Emil
Emil

Reputation: 2806

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

In your getHeaderView() method add this line

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;
    }

Upvotes: 1

Related Questions