2
That’s how I’m doing the listing I’d like to know if it’s possible to put each item in a different color for example 1 in white and one in black
ArrayAdapter adapter = new ArrayAdapter<>(MainActivity.this, android.R.layout.simple_list_item_1, list);
lista.setAdapter(adapter);
I saw this example but it only adapts if I have an Adapter class , some way to adapt it to the code I showed above?
public View getView(int position, View convertView, ViewGroup parent) {
/* remainder is unchanged */
convertView.setBackgroundColor(position % 2 == 0 ? Color.WHITE : Color.GREY);
return convertView;
}
No, you’ll have to implement a custom Adapter.
– ramaral
@'cause it’s like I told you...
– Jorge B.