开发者

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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜