Note that there are some explanatory texts on larger screens.

plurals
  1. POListView items fading when scrolling in Android
    primarykey
    data
    text
    <p>I'm developing for Android and I have an app (called Forget-Me-Not) that uses a <code>ListView</code> as the Tasks screen (Its a ToDo list app). And I have set the items to be grayed out when they are completed.</p> <p>When the list is bigger than the screen, scrolling occur as usual. But the problem is when scrolled upwards/downwards and come back again, the uncompleted items too have been grayed out. I have checked this many times and the graying-out seems to be random. The items are clickable and they are functioning as expected (i.e. long-clicking, etc). The only problem is the graying-out. (This confuses the users as this app is ToDo list managing app and graying-out is "completing" a task).</p> <p>I don't know what code to post, so if anyone can tell me what code I should post or could give an answer straightaway, I would be really thankful.</p> <p>PS: I've got a custom ListAdapter class. It mainly reads the items from SQLite database and sets them to the adapter. You can see the bug in my app- its in the Android Market (Forget-Me-Not).</p> <p>EDIT: Here is my custom TaskAdapter class:</p> <pre><code>public class TasksAdapter extends BaseAdapter { private String[] items; private int[] priorities; private Vector&lt;String&gt; completed; private Context context; public TasksAdapter(TasksActivity context, int textViewResourceId, String[] items) { if(items != null) this.items = items; else this.items = new String[0]; this.priorities = new int[this.items.length]; for(int i = 0; i &lt; this.priorities.length; i++) { this.priorities[i] = FMN.PRIORITY_LOW; } this.completed = new Vector&lt;String&gt;(0); this.context = context; } public TasksAdapter(TasksActivity context, int textViewResourceId, String[] items, int[] priorities, Vector&lt;String&gt; completed) { if(items != null) this.items = items; else this.items = new String[0]; if(priorities != null) this.priorities = priorities; else { this.priorities = new int[this.items.length]; for(int i = 0; i &lt; this.priorities.length; i++) { this.priorities[i] = FMN.PRIORITY_LOW; } } if(completed != null) this.completed = completed; else this.completed = new Vector&lt;String&gt;(0); this.context = context; } public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.task_item, null); } TextView task = (TextView) v.findViewById(R.id.tv_task); task.setText(items[position]); ImageView prio = (ImageView) v.findViewById(R.id.im_task_priority); switch(priorities[position]) { case FMN.PRIORITY_HIGH: prio.setImageResource(R.drawable.fmn_priority_high); break; case FMN.PRIORITY_MEDIUM: prio.setImageResource(R.drawable.fmn_priority_low); break; case FMN.PRIORITY_LOW: prio.setImageResource(R.drawable.fmn_priority_medium); break; default: prio.setImageResource(R.drawable.fmn_priority_medium); break; } if((completed.size() != 0) &amp;&amp; (completed.contains(task.getText()))) { task.setTextColor(Color.rgb(155, 175, 155)); } return v; } public int getCount() { return items.length; } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } } </code></pre> <hr> <p>And a screenshot BEFORE scrolling:</p> <h2><img src="https://i.stack.imgur.com/vKkT1.png" alt="Before Scrolling"></h2> <p>And AFTER scrolling: <img src="https://i.stack.imgur.com/TJvsu.png" alt="After Scrolling"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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