我在一个活动中工作以显示字符串列表,就像这样:
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
String[] lKeys = new String[mKey.size()];
int i = 0;
if (lKeys != null) {
for (Iterator<String> ite = mKey.iterator(); ite.hasNext();) {
String element = ite.next();
if (element.contains("Data")) {
lKeys[i++] = element;
} else {
lKeys[i++] = element + ": " + mValue.get(element);
}
}
}
//
this.setTitle(mTitle);
setListAdapter(new ArrayAdapter<String>(this,R.layout.popupactivity,lKeys));
用这个 xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tvResults"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#000000"
android:background="#ffffff"
android:layout_marginLeft="5dp"
android:textSize="12sp"
android:padding="5dp" >
</TextView>
这很好用,但我需要在列表的行中添加一些颜色。谁能帮我?
真的感谢!