java - How to change the font of textview when it is a part of listview using SimpleAdapter -
following code :
and wanna change font of textview id 'name12'. need help. thank in advance.
string rid = jobj.getstring(tag_rid); string name = jobj.getstring(tag_name); hashmap<string, string> map = new hashmap<string, string>(); map.put(tag_rid, rid); map.put(tag_name, name); oslist.add(map); listadapter adapter = new simpleadapter(mainactivity.this, oslist, r.layout.list_v, new string[] { tag_name }, new int[] { r.id.name12}); l1.setadapter(adapter);
you can extend textview
class , set font inside.
after can use textview
in r.layout.list_v
public class textviewwithfont extends textview { public textviewwithfont(context c) { this(c, null); } public textviewwithfont(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); settypeface(typeface.createfromasset(context.getassets(), "fontname.ttf")); } public textviewwithfont(context context, attributeset attrs) { this(context, attrs, 0); } }
Comments
Post a Comment