Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to change header color of listview while select item of listview?
    text
    copied!<p>I am using Separeted List, it has multiple headers and I want to change the color of selected list item header. Here are my code that able to find the position of header and I can change the color of first header when first section of list selected. When I select another section of list I am not able to change the color of another headers.</p> <p>In this I am using ArrayAdapter i.e not reuse view If onetime created view it is not change. So how to use conditions and loops for this any one can suggest.</p> <p>Here is my view method of <a href="http://w2davids.wordpress.com/android-sectioned-headers-in-listviews/" rel="nofollow">SepratorListAdapter</a> class</p> <pre><code>public View getView(int position, View convertView, ViewGroup parent) { int sectionnum = 0; for(Object section : this.sections.keySet()) { Adapter adapter = sections.get(section); int size = adapter.getCount() + 1; if(position==0) { TextView tv = (TextView)headers.getView(sectionnum, convertView, parent).findViewById(R.id.txt_week); if(sectionnum==header_pos) { headers.getView(sectionnum, convertView, parent).setBackgroundResource(R.drawable.red_strip); } else { headers.getView(sectionnum, convertView, parent).setBackgroundResource(R.drawable.gray_strip); } return headers.getView(sectionnum, convertView, parent); } if(position &lt; size) { return adapter.getView(position - 1, convertView, parent); } position -= size; sectionnum++; } return null; } </code></pre> <p>There are any solution and trick please suggest. Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload