title: How to set the background color of all ListView Items
body: <p>I have got the following for setting the background color for a single item when clicking on it:</p>
  <pre><code>        // Get the listView on the Home Fragment
          val contactList = findViewById&lt;ListView&gt;(R.id.listViewContacts)
          // Create IDs for each element
          val id : Int = R.id.txtListElement
  
          // Fill the ListView with the custom contact_list_template
          arrayAdapter = ArrayAdapter(this,
              R.layout.contact_list_template, id, contactSimple)
          contactList.adapter = arrayAdapter
  
          contactList.onItemClickListener = AdapterView.OnItemClickListener { adapterView, view,
                                                                              position, _ -&gt;
              val selectedItem = adapterView.getItemAtPosition(position) as String
              val itemIdAtPos = adapterView.getItemIdAtPosition(position)
  
  
              view.setBackgroundColor(ContextCompat.getColor(this, R.color.purple_200))
              ...
          }
  </code></pre>
  <p>But how can I set the color for every object inside the ListView?
  I tried
  <code>contactList.setBackgroundColor(ContextCompat.getColor(this, R.color.white))</code> but that does not seem to work.</p>