我有两个字符串数组:array1和array2。
如何更改字体类型?
如何更改数组中某些元素的颜色(例如第一个和第五个元素)?
我的字体类型是 raw/price.ttf。
ListView listView1=(ListView) findViewById(R.id.listView1);
List<Map<String, String>> data = new ArrayList<Map<String, String>>();
for (int i=0; i<array2.length; i++) {
Map<String, String> datum = new HashMap<String, String>(2);
datum.put("title", array1[i]);
datum.put("subtitle", String.valueOf(array2[i]));
data.add(datum);
}
SimpleAdapter adapter3 = new SimpleAdapter(this, data,
android.R.layout.simple_list_item_2,
new String[] {"title", "subtitle"},
new int[] {android.R.id.text1,
android.R.id.text2});
listView1.setAdapter(adapter3);
这是我的xml
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:scrollingCache="false">
</ListView>