这是一个示例代码,您可以更改为您的
AndroidMultiChoiceListActivity .java
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class AndroidMultiChoiceListActivity extends Activity {
ListView choiceList;
String[] choice = { "Choice A",
"Choice B", "Choice C", "Choice D", "Choice E"};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
choiceList = (ListView)findViewById(R.id.list);
ArrayAdapter<String> adapter
= new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice,
choice);
choiceList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
choiceList.setAdapter(adapter);
}
}
主要的.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
android:textColor="#334422"
/>
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
在您的 Textview 中用于android:textColor="#334422"
更改文本的颜色。