۱۳۹۳/۱۱/۲۲, ۱۲:۵۴ ب.ظ
[font]سلام
من در جایی که textview را تعریف کرده از setTypeface استفاده کردم ولی تابع getAssets را نمیشناسه و خطا میگیره:[/font]
من در جایی که textview را تعریف کرده از setTypeface استفاده کردم ولی تابع getAssets را نمیشناسه و خطا میگیره:[/font]
کد پیاچپی:
public class CustomList extends ArrayAdapter<String>{
private final Activity context;
private final String[] web;
private final Integer[] imageId;
public CustomList(Activity context,
String[] web, Integer[] imageId) {
super(context, R.layout.list_single, web);
this.context = context;
this.imageId = imageId;
this.web = web;
}
@Override
public View getView(int position, View view, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View rowView= inflater.inflate(R.layout.list_single, null, true);
ImageView imageView = (ImageView) rowView.findViewById(R.id.img);
TextView txtTitle = (TextView) rowView.findViewById(R.id.txt);
///////////////////////////////////// در خط زیر تابع کت استس را خطا میگیره ///////////////////////////////////////
Typeface myfont = Typeface.createFromAsset(getAssets(), "fonts/koodak.ttf");
txtTitle.setTypeface(myfont);
////////////////////////////////////////////////////////////////////////////
imageView.setImageResource(imageId[position]);
txtTitle.setText(web[position]);
return rowView;
}
}