我必须更改自定义列表适配器上的字体。我有一个问题,因为我无法获得当前的上下文。
getassets() not exist for the class
getApplicationcontext() not exist for the class
getBaseContext() not exist for the class
我正在尝试从视图中获取上下文,没有错误,但字体没有改变
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
Context context = convertView.getContext();
//or
Context context2 = parent.getContext();
在我写的代码之后
bold = Typeface.createFromAsset(context.getAssets(), "fonts/Jennifer-Lynne.ttf");
italic = Typeface.createFromAsset(context.getAssets(), "fonts/helvetica-italic.ttf");
holder.titoloView.setTypeface(bold);
holder.autoreView.setTypeface(italic);
主意?