android - Text color changes of Row in List View when selected -


i facing problem while selecting items in list view. doing here is, when user selects item list view, color of item(here text) changes cyan (default black). but, when scroll list view, items not selected user, color changes. tried resolved it, have not find solution. below code..

first.xml

<listview         android:id="@+id/list1"         android:layout_width="220dp"         android:layout_height="300dp"         android:layout_marginleft="45dp"         android:layout_margintop="80dp"         android:cachecolorhint="#00000000"         android:fastscrollenabled="true" >     </listview> 

second.xml

<checkedtextview     android:id="@+id/txt"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignparentleft="true"     android:layout_alignparenttop="true"     android:text=""     android:textsize="20sp" /> 

first.java

checkedtextview chktext;     sparsebooleanarray checked;      lvdialog.setonitemclicklistener(new onitemclicklistener() {                  @override                 public void onitemclick(adapterview<?> arg0, view arg1,                         int arg2, long arg3) {                     // todo auto-generated method stub                     length_friends = lvdialog.getcount();                     checked = lvdialog.getcheckeditempositions();                     chktext = (checkedtextview) arg1.findviewbyid(r.id.txt);                     lvdialog.invalidateviews();                      if(checked.get(arg2))                     {                         chktext.settextcolor(color.cyan);                         colorrow ++;                     }                     else                     {                         chktext.settextcolor(color.black);                         colorrow = 0;                     }                 }             }); 

above code, in used checked text view. needs done solve problem?


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -