似乎是一个简单的问题,但由于我是 Android 开发新手,所以我对 Android ListViews 知之甚少。以下是我在项目中用于 ListView 的代码。
/*Listview code starts*/
mainListView = (ListView) findViewById( R.id.mainListView );
ArrayList<String> planetList = new ArrayList<String>();
planetList.addAll( Arrays.asList(values) );
listAdapter = new ArrayAdapter<String>(this, R.layout.list1, values);
mainListView.setAdapter(listAdapter);
mainListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// TODO Auto-generated method stub
int itemPosition = position;
String itemValue = (String) mainListView.getItemAtPosition(position);
Toast.makeText(getApplicationContext(),
"Position :"+itemPosition+" ListItem : " +itemValue , Toast.LENGTH_LONG)
.show();
}
});
/*Listview code ends*/
我希望更改我的 ListView 文本的字体。我怎么做?到处阅读使用自定义的Adapter,但没看懂。谁能帮我写代码?