android - EfficientAdapter and text format -


I am using the EfficientAdapter that listsActivity Expands for some reason, when I use the code: < / P>

  public view getView (see the status of int, seeviewview, ViewGroup parent) {ViewHolder holder; If (convertView == empty) {convertView = mInflater.inflate (R.layout.list_item_icon_text, null); Holder = new viewholder (); Holder.txt = (TextView) ConvertViewFindVBID (RTEText); Holder.txt .set padding ((int (varscrynoid-300), 30, 0, 30); If (position == 1) {holder.text.setPadding (20, 0, 20, 0); Holder.text.setBackgroundColor (Color.DKGRAY); } And {holder.txt .set padding (20, 20, 20, 20); Holder.text.setBackgroundColor (Color.TRANSPARENT); }} ConvertView.setTag (Holder); } And {holder = (seeholder) ConvertView.gettag (); } Holder.txt .set text (string.value (wars.adademin [position])); Return Convertview; }   

I get a list, but instead of just 1 item with color. DKARAR, I remember it on other items. I scroll up and down and change from one item in the background to any idea?

Recycling ideas (i.e. setting up the colors showing you in situations other than 1) So to work properly, you need to move the code where you change the padding and color depending on the condition outside the convertView == blank block.

  if (convertView == empty) {convertView = mInflater.inflate (R.layout.list_item_icon_text, null); Holder = new viewholder (); Holder.txt = (TextView) ConvertViewFindVBID (RTEText); Holder.txt .set padding ((int (varscrynoid-300), 30, 0, 30); ConvertView.setTag (holder); } And {holder = (seeholder) ConvertView.gettag (); } If (position == 1) {holder.text.setPadding (20, 0, 20, 0); Holder.text.setBackgroundColor (Color.DKGRAY); } And {holder.txt .set padding (20, 20, 20, 20); Holder.text.setBackgroundColor (Color.TRANSPARENT); } Holder.txt .set text (string.value (wars.adademin [position]));    

Comments