android setTypeface
I have a simple main class
public void onCreate(Bundle savedInstanceState)
{
databaseHelper = new wecDatabasesManager(this);
databaseHelper.open();
super.onCreate(savedInstanceState);
series = databaseHelper.getSeries();
startManagingCursor(series);
setListAdapter(new SeriesListAdapter(this, series));
registerForContextMenu(getListView());
}
I also have a simple adapter
public class SeriesListAdapter extends SimpleCursorAdapter开发者_Go百科
{
public SeriesListAdapter(Context context, Cursor c) {
super(context,R.layout.series_row, c,
new String[] { wecSeriesTable.NAME },
new int[] {R.id.series_name});
}
@Override
public void bindView(View view, Context context, Cursor cursor)
{
super.bindView(view, context, cursor);
String SerieName = cursor.getString(cursor.getColumnIndex(wecSeriesTable.NAME));
}
}
Now my question: How can i change the fontface?
i have found this code
Typeface font = Typeface.createFromAsset(getAssets(), "whatelsecomicsfont.ttf");
TextView txt = (TextView) findViewById(R.id.series_name);
txt.setTypeface(font);
i had pasted it into getView method in my main class but it don't work Any idea?
Change the font file (*.ttf file)
精彩评论