0

In my application I have use JSON web services.Through the web services I get Telugu font. How to add this Telugu font to my spinner?

LayoutInflater lv = getLayoutInfalter();
View v = lv.inflate(R.layout.spineerfont,false);
TextView tv = (TextView)v.findViewById(R.id.sp);
Typeface faceGautami = Typeface.createFromAsset(getAssets(), "gautami.ttf");
tv.setTypeface(faceGautami);
Andrew T.
  • 4,701
  • 8
  • 43
  • 62
karthik
  • 209
  • 1
  • 6
  • 11

1 Answers1

0

You can apply the font through your own custom SpinnerAdapter, in getView() and getDropDownView().

public View getView(int position, View convertView, ViewGroup parent) {

LayoutInflater inflater = getLayoutInflater();
View row = inflater.inflate(yourRowlayout, parent,false);
TextView make = (TextView) row.findViewById(R.id.sp);
Typeface myTypeFace = Typeface.createFromAsset(context.getAssets(),
            "fonts/gautami.ttf");
v.setTypeface(myTypeFace);
v.setText(itemList.get(position));
return row;
}


public View getDropDownView(int position, View convertView, ViewGroup parent) {

LayoutInflater inflater = getLayoutInflater();
View row = inflater.inflate(yourRowlayout, parent,false);
TextView make = (TextView) row.findViewById(R.id.sp);
Typeface myTypeFace = Typeface.createFromAsset(context.getAssets(),
            "fonts/gautami.ttf");
v.setTypeface(myTypeFace);
v.setText(itemList.get(position));
return row;
}
Linga
  • 10,379
  • 10
  • 52
  • 104