1
我已經繼承了ListActivity,我需要更改一些行的代碼背景顏色。如何做到這一點,例如第一行設置YELLOW背景?如何更改代碼中的一個項目從列表視圖的背景
public class AlarmsActivity extends ListActivity {
private Activity currentActivity;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(this, R.layout.alarms, DATA));
currentActivity = this;
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
Toast.makeText(getApplicationContext(),
((TextView) arg1).getText(), Toast.LENGTH_SHORT).show();
}
});
}
static final String[] DATA = new String[] {"Name","Last Name","Address","City" };
}