如何更改ListView项目的字体?在这里,我想将字体更改为helvetica常规字体。我的TextView被分配给字符串变量。请帮帮我。先谢谢你。如何更改列表项目的自定义字体
lv.setOnItemClickListener(newandroid.widget.AdapterView.OnItemClickListener() {
@Override
public void onItemClick (AdapterView <?> arg0, View view,int arg2, long arg3){
String countryname = ((TextView) view.findViewById(R.id.countryname)).getText().toString();//this is the textview id assigned to the string variable//
String coutrylist = "Algeria:DZ:213:49,Adrar;27,Ain Defla;43,Ain Temouchent"// these are the some of the list items in the list view//
String split[] = coutrylist.split("\\$");
// creating new HashMap
String cid = "";
String ccode = "";
for (int i = 0; i < split.length; i++) {
if (split[i].startsWith(countryname)) {
String split3[] = split[i].split("\\:");
cid = split3[2];
ccode = split3[1];
}
}
// On selecting single track get song information
Intent i = new Intent(getApplicationContext(), Npanxx.class);
//Toast.makeText(getApplicationContext(), "seleceted : " + countryname, Toast.LENGTH_SHORT).show();
i.putExtra("country", countryname);
i.putExtra("code", ccode);
i.putExtra("id", cid);
startActivity(i);
}
});
我指定我的TextView的id变量如何typface设置为国名 –
保护无效onPostExecute(字符串FILE_URL){ \t \t \t //获取所有专辑 \t \t \t pDialog.dismiss后关闭该对话框();从后台线程 \t \t \t runOnUiThread(新的Runnable(){ \t \t \t \t公共无效的run(){ \t \t \t \t \t/** \t \t \t \t \t *更新 \t \t \t //更新UI解析JSON数据到ListView中 \t \t \t \t \t * */ \t \t \t \t \t ListAdapter适配器=新SimpleAdapter( \t \t \t \t \t \t \t CoutryList.this,albumsList, \t \t \t \t \t \t \t R.layout。country_list_item2,新的String [] {\t TAG_NAME,TAG_ID},新INT [] { \t \t \t \t \t \t \t \t \t R.id.countryname,R.id.countryflag}); \t \t \t \t \t \t \t \t \t \t //更新列表视图 \t \t \t \t \t setListAdapter(适配器); \t \t \t \t} \t \t \t}); \t \t} –