You need to create a Custome TextViewto change the color of all ListView items, instead of passing the default android.R.layout.simple_list_item_multiple_choiceto ArrayAdapter, you must pass a custom XML list item that has a different TextColor attribute.
For example, the created custom_list_item.xml in the Layout folder:
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textView"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:textColor="#FF00FF"
/>
Then it passed it to the adapter, as shown below:
new ArrayAdapter<String>(this, R.layout.custom_list_item, playersName);
Edition:
Here is the code that works fine, I tested.
lv.setAdapter(new ArrayAdapter<String>(this, R.layout.custom_list_item, playersName));
lv.setBackgroundColor(Color.BLACK);
lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
lv.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> p_arg0, View p_arg1, int p_arg2, long p_arg3)
{
my_sel_items = new String("Selected Items");
SparseBooleanArray a = lv.getCheckedItemPositions();
for (int i = 0; i < a.size(); i++) {
if (a.valueAt(i)) {
my_sel_items = my_sel_items + ","
+ (String) lv.getAdapter().getItem(i);
}
}
Log.v("values", my_sel_items);
}
});
View List Layout
<ListView
android:id="@+id/android:list"
android:layout_marginTop="60dip"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#000000"
/>