我想使自定義字體爲我的TextView之一,但我仍然得到自定義字體在Android的ExpandableListView
cannot resolve method getAssets()
下面是部分代碼:
@Override
public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
final String childText = (String)getChild(groupPosition, childPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater)this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_item, parent, false);
}
Utils.setFontAllView((ViewGroup)convertView);
TextView txtListChild = (TextView)convertView.findViewById(R.id.txtcardname);
txtListChild.setTypeface(null, Typeface.BOLD);
TextView kategoria = (TextView)convertView.findViewById(R.id.kategoria);
kategoria.setText(this.KATEGORIE[numerKategori]);
custom_font = Typeface.createFromAsset(getAssets(), "fonts/capture.ttf");
txtListChild.setTypeface(custom_font);
我要打它使用此代碼:
custom_font = Typeface.createFromAsset(getAssets(), "fonts/capture.ttf");
txtListChild.setTypeface(custom_font);