我有一个白色背景,但是这个布局我被阻止了,因为文本颜色也是白色的,我找不到使它变成红色的解决方案,所以我可以设置我的白色背景,请帮忙(你可以看到我被迫使用她的红色背景,这样我就可以看到白色文字)。
public class QueueListActivity extends ListActivity {
// LIST OF ARRAY STRINGS WHICH WILL SERVE AS LIST ITEMS
ArrayList<String> listItems = new ArrayList<String>();
String newtext;
String listFiles;
// DEFINING STRING ADAPTER WHICH WILL HANDLE DATA OF LISTVIEW
ArrayAdapter<String> adapter;
// RECORDING HOW MUCH TIMES BUTTON WAS CLICKED
int clickCounter = 0;
ArrayList<String> selectedItems = new ArrayList<String>();
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.queuelistactivity);
Bundle extras1 = getIntent().getExtras();
listFiles=GetFiles();
StringTokenizer tokonizer1 = new StringTokenizer(listFiles,";");
while(tokonizer1.hasMoreElements()){
Log.i("verif","0");
listItems.add(tokonizer1.nextToken());}
initializeListItems();
if (extras1 != null) {
newtext = extras1.getString("newitem");
listItems.add(newtext);
adapter.notifyDataSetChanged();
getListView().setItemChecked(listItems.size() - 1, false);
}
}
// METHOD WHICH WILL HANDLE DYNAMIC INSERTION
public void addItems(View v) {
Intent intent = new Intent(QueueListActivity.this, AjouterFiles.class);
QueueListActivity.this.startActivity(intent);
/*
listItems.add(userName);
adapter.notifyDataSetChanged();
getListView().setItemChecked(listItems.size() - 1, false);*/
}
public void deleteItems(View v) {
String toDelete = "";
SparseBooleanArray sp = getListView().getCheckedItemPositions();
for (int i = 0; i < sp.size(); i++) {
toDelete += ";" + sp.get(i);
if (sp.get(i)) {
listItems.remove(i);
}
}
adapter.notifyDataSetChanged();
Toast.makeText(getApplicationContext(), toDelete, Toast.LENGTH_LONG).show();
initializeListItems();
}
private void initializeListItems() {
adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_multiple_choice, listItems);
setListAdapter(adapter);
ListView lv = getListView();
lv.setCacheColorHint(Color.rgb(0, 0, 0));
lv.setBackgroundColor(Color.rgb(178, 34, 34));
for (int i = 0; i < lv.getCount(); i++) {
lv.setItemChecked(i, false);
}
}